@@ -36,6 +36,8 @@ type AvailableIntegrationItem struct {
3636 Description string `json:"description,omitempty"`
3737 Registration * JSONSchema `json:"registration"`
3838 Attachment * JSONSchema `json:"attachment"`
39+ // Subscribed inputs (material types)
40+ SubscribedInputs []string `json:"subscribedInputs"`
3941}
4042
4143type JSONSchema struct {
@@ -90,20 +92,27 @@ func pbAvailableIntegrationItemToAction(in *pb.IntegrationAvailableItem) (*Avail
9092 return nil , errors .New ("nil input" )
9193 }
9294
95+ if in .GetFanout () == nil {
96+ fmt .Printf ("skipping integration %s, type not supported\n " , in .GetId ())
97+ return nil , nil
98+ }
99+
100+ foType := in .GetFanout ()
101+
93102 i := & AvailableIntegrationItem {
94103 ID : in .GetId (), Version : in .GetVersion (), Description : in .GetDescription (),
95- Registration : & JSONSchema {Raw : string (in .GetRegistrationSchema ())},
96- Attachment : & JSONSchema {Raw : string (in .GetAttachmentSchema ())},
104+ Registration : & JSONSchema {Raw : string (foType .GetRegistrationSchema ())},
105+ Attachment : & JSONSchema {Raw : string (foType .GetAttachmentSchema ())},
97106 }
98107
99108 // Parse the schemas so they can be used for validation or other purposes
100109 var err error
101- i .Registration .Parsed , err = compileJSONSchema (in .GetRegistrationSchema ())
110+ i .Registration .Parsed , err = compileJSONSchema (foType .GetRegistrationSchema ())
102111 if err != nil {
103112 return nil , fmt .Errorf ("failed to compile registration schema: %w" , err )
104113 }
105114
106- i .Attachment .Parsed , err = compileJSONSchema (in .GetAttachmentSchema ())
115+ i .Attachment .Parsed , err = compileJSONSchema (foType .GetAttachmentSchema ())
107116 if err != nil {
108117 return nil , fmt .Errorf ("failed to compile registration schema: %w" , err )
109118 }
@@ -119,6 +128,9 @@ func pbAvailableIntegrationItemToAction(in *pb.IntegrationAvailableItem) (*Avail
119128 return nil , fmt .Errorf ("failed to calculate attachment properties: %w" , err )
120129 }
121130
131+ // Subscribed inputs
132+ i .SubscribedInputs = append (i .SubscribedInputs , foType .GetSubscribedMaterials ()... )
133+
122134 return i , nil
123135}
124136
0 commit comments