Skip to content

Commit 19e5f64

Browse files
committed
use nested root mis within each conversationroute
1 parent 1844625 commit 19e5f64

File tree

5 files changed

+555
-228
lines changed

5 files changed

+555
-228
lines changed

packages/appsync-modelgen-plugin/schemas/introspection/1/ModelIntrospectionSchema.json

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,18 @@
548548
"SchemaConversationRoute": {
549549
"type": "object",
550550
"properties": {
551+
"name": {
552+
"type": "string"
553+
},
554+
"models": {
555+
"$ref": "#/definitions/SchemaModels"
556+
},
557+
"nonModels": {
558+
"$ref": "#/definitions/SchemaNonModels"
559+
},
560+
"enums": {
561+
"$ref": "#/definitions/SchemaEnums"
562+
},
551563
"conversation": {
552564
"$ref": "#/definitions/SchemaConversation"
553565
},
@@ -556,6 +568,10 @@
556568
}
557569
},
558570
"required": [
571+
"name",
572+
"models",
573+
"nonModels",
574+
"enums",
559575
"conversation",
560576
"message"
561577
],
@@ -564,32 +580,20 @@
564580
"SchemaConversation": {
565581
"type": "object",
566582
"properties": {
567-
"create": {
568-
"$ref": "#/definitions/SchemaMutation"
569-
},
570-
"get": {
571-
"$ref": "#/definitions/SchemaQuery"
572-
},
573-
"delete": {
574-
"$ref": "#/definitions/SchemaMutation"
575-
},
576-
"list": {
577-
"$ref": "#/definitions/SchemaQuery"
583+
"modelName": {
584+
"type": "string"
578585
}
579586
},
580587
"required": [
581-
"create",
582-
"get",
583-
"delete",
584-
"list"
588+
"modelName"
585589
],
586590
"additionalProperties": false
587591
},
588592
"SchemaConversationMessage": {
589593
"type": "object",
590594
"properties": {
591-
"list": {
592-
"$ref": "#/definitions/SchemaQuery"
595+
"modelName": {
596+
"type": "string"
593597
},
594598
"subscribe": {
595599
"$ref": "#/definitions/SchemaSubscription"
@@ -599,7 +603,7 @@
599603
}
600604
},
601605
"required": [
602-
"list",
606+
"modelName",
603607
"subscribe",
604608
"send"
605609
],

packages/appsync-modelgen-plugin/src/__tests__/visitors/__snapshots__/appsync-model-introspection-visitor.test.ts.snap

Lines changed: 229 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,248 @@ exports[`Conversation Route Introspection Visitor Metadata snapshot should gener
66
\\"models\\": {},
77
\\"enums\\": {},
88
\\"nonModels\\": {},
9-
\\"conversationRoutes\\": {
9+
\\"conversations\\": {
1010
\\"pirateChat\\": {
11-
\\"conversation\\": {
12-
\\"create\\": {
13-
\\"name\\": \\"createConversationpirateChat\\",
14-
\\"isArray\\": false,
15-
\\"type\\": {
16-
\\"model\\": \\"ConversationpirateChat\\"
17-
},
18-
\\"isRequired\\": false
19-
},
20-
\\"get\\": {
21-
\\"name\\": \\"getConversationpirateChat\\",
22-
\\"isArray\\": false,
23-
\\"type\\": {
24-
\\"model\\": \\"ConversationpirateChat\\"
25-
},
26-
\\"isRequired\\": false,
27-
\\"arguments\\": {
11+
\\"name\\": \\"pirateChat\\",
12+
\\"models\\": {
13+
\\"ConversationPirateChat\\": {
14+
\\"name\\": \\"ConversationPirateChat\\",
15+
\\"fields\\": {
2816
\\"id\\": {
2917
\\"name\\": \\"id\\",
3018
\\"isArray\\": false,
19+
\\"type\\": \\"ID\\",
3120
\\"isRequired\\": true,
32-
\\"type\\": \\"String\\"
21+
\\"attributes\\": []
22+
},
23+
\\"name\\": {
24+
\\"name\\": \\"name\\",
25+
\\"isArray\\": false,
26+
\\"type\\": \\"String\\",
27+
\\"isRequired\\": false,
28+
\\"attributes\\": []
29+
},
30+
\\"metadata\\": {
31+
\\"name\\": \\"metadata\\",
32+
\\"isArray\\": false,
33+
\\"type\\": \\"AWSJSON\\",
34+
\\"isRequired\\": false,
35+
\\"attributes\\": []
36+
},
37+
\\"messages\\": {
38+
\\"name\\": \\"messages\\",
39+
\\"isArray\\": true,
40+
\\"type\\": {
41+
\\"model\\": \\"ConversationMessagePirateChat\\"
42+
},
43+
\\"isRequired\\": false,
44+
\\"attributes\\": [],
45+
\\"isArrayNullable\\": true,
46+
\\"association\\": {
47+
\\"connectionType\\": \\"HAS_MANY\\",
48+
\\"associatedWith\\": [
49+
\\"conversationid\\"
50+
]
51+
}
52+
},
53+
\\"createdAt\\": {
54+
\\"name\\": \\"createdAt\\",
55+
\\"isArray\\": false,
56+
\\"type\\": \\"AWSDateTime\\",
57+
\\"isRequired\\": false,
58+
\\"attributes\\": [],
59+
\\"isReadOnly\\": true
60+
},
61+
\\"updatedAt\\": {
62+
\\"name\\": \\"updatedAt\\",
63+
\\"isArray\\": false,
64+
\\"type\\": \\"AWSDateTime\\",
65+
\\"isRequired\\": false,
66+
\\"attributes\\": [],
67+
\\"isReadOnly\\": true
3368
}
69+
},
70+
\\"syncable\\": true,
71+
\\"pluralName\\": \\"ConversationPirateChats\\",
72+
\\"attributes\\": [
73+
{
74+
\\"type\\": \\"model\\",
75+
\\"properties\\": {
76+
\\"subscriptions\\": {
77+
\\"level\\": \\"off\\"
78+
},
79+
\\"mutations\\": {
80+
\\"update\\": null
81+
}
82+
}
83+
},
84+
{
85+
\\"type\\": \\"auth\\",
86+
\\"properties\\": {
87+
\\"rules\\": [
88+
{
89+
\\"provider\\": \\"userPools\\",
90+
\\"ownerField\\": \\"owner\\",
91+
\\"allow\\": \\"owner\\",
92+
\\"identityClaim\\": \\"cognito:username\\",
93+
\\"operations\\": [
94+
\\"create\\",
95+
\\"update\\",
96+
\\"delete\\",
97+
\\"read\\"
98+
]
99+
}
100+
]
101+
}
102+
}
103+
],
104+
\\"primaryKeyInfo\\": {
105+
\\"isCustomPrimaryKey\\": false,
106+
\\"primaryKeyFieldName\\": \\"id\\",
107+
\\"sortKeyFieldNames\\": []
34108
}
35109
},
36-
\\"delete\\": {
37-
\\"name\\": \\"deleteConversationpirateChat\\",
38-
\\"isArray\\": false,
39-
\\"type\\": {
40-
\\"model\\": \\"ConversationpirateChat\\"
41-
},
42-
\\"isRequired\\": false,
43-
\\"arguments\\": {
110+
\\"ConversationMessagePirateChat\\": {
111+
\\"name\\": \\"ConversationMessagePirateChat\\",
112+
\\"fields\\": {
44113
\\"id\\": {
45114
\\"name\\": \\"id\\",
46115
\\"isArray\\": false,
116+
\\"type\\": \\"ID\\",
117+
\\"isRequired\\": true,
118+
\\"attributes\\": []
119+
},
120+
\\"conversationId\\": {
121+
\\"name\\": \\"conversationId\\",
122+
\\"isArray\\": false,
123+
\\"type\\": \\"ID\\",
47124
\\"isRequired\\": true,
48-
\\"type\\": \\"String\\"
125+
\\"attributes\\": []
126+
},
127+
\\"conversation\\": {
128+
\\"name\\": \\"conversation\\",
129+
\\"isArray\\": false,
130+
\\"type\\": {
131+
\\"model\\": \\"ConversationPirateChat\\"
132+
},
133+
\\"isRequired\\": false,
134+
\\"attributes\\": [],
135+
\\"association\\": {
136+
\\"connectionType\\": \\"BELONGS_TO\\",
137+
\\"targetNames\\": [
138+
\\"conversationId\\"
139+
]
140+
}
141+
},
142+
\\"sender\\": {
143+
\\"name\\": \\"sender\\",
144+
\\"isArray\\": false,
145+
\\"type\\": {
146+
\\"enum\\": \\"ConversationMessageSender\\"
147+
},
148+
\\"isRequired\\": false,
149+
\\"attributes\\": []
150+
},
151+
\\"content\\": {
152+
\\"name\\": \\"content\\",
153+
\\"isArray\\": false,
154+
\\"type\\": \\"String\\",
155+
\\"isRequired\\": false,
156+
\\"attributes\\": []
157+
},
158+
\\"context\\": {
159+
\\"name\\": \\"context\\",
160+
\\"isArray\\": false,
161+
\\"type\\": \\"AWSJSON\\",
162+
\\"isRequired\\": false,
163+
\\"attributes\\": []
164+
},
165+
\\"uiComponents\\": {
166+
\\"name\\": \\"uiComponents\\",
167+
\\"isArray\\": true,
168+
\\"type\\": \\"AWSJSON\\",
169+
\\"isRequired\\": false,
170+
\\"attributes\\": [],
171+
\\"isArrayNullable\\": true
172+
},
173+
\\"assistantContent\\": {
174+
\\"name\\": \\"assistantContent\\",
175+
\\"isArray\\": false,
176+
\\"type\\": \\"String\\",
177+
\\"isRequired\\": false,
178+
\\"attributes\\": []
179+
},
180+
\\"createdAt\\": {
181+
\\"name\\": \\"createdAt\\",
182+
\\"isArray\\": false,
183+
\\"type\\": \\"AWSDateTime\\",
184+
\\"isRequired\\": false,
185+
\\"attributes\\": [],
186+
\\"isReadOnly\\": true
187+
},
188+
\\"updatedAt\\": {
189+
\\"name\\": \\"updatedAt\\",
190+
\\"isArray\\": false,
191+
\\"type\\": \\"AWSDateTime\\",
192+
\\"isRequired\\": false,
193+
\\"attributes\\": [],
194+
\\"isReadOnly\\": true
49195
}
50-
}
51-
},
52-
\\"list\\": {
53-
\\"name\\": \\"listConversationpirateChat\\",
54-
\\"isArray\\": true,
55-
\\"type\\": {
56-
\\"model\\": \\"ConversationpirateChat\\"
57196
},
58-
\\"isRequired\\": false
197+
\\"syncable\\": true,
198+
\\"pluralName\\": \\"ConversationMessagePirateChats\\",
199+
\\"attributes\\": [
200+
{
201+
\\"type\\": \\"model\\",
202+
\\"properties\\": {
203+
\\"subscriptions\\": {},
204+
\\"mutations\\": {
205+
\\"update\\": null
206+
}
207+
}
208+
},
209+
{
210+
\\"type\\": \\"auth\\",
211+
\\"properties\\": {
212+
\\"rules\\": [
213+
{
214+
\\"provider\\": \\"userPools\\",
215+
\\"ownerField\\": \\"owner\\",
216+
\\"allow\\": \\"owner\\",
217+
\\"identityClaim\\": \\"cognito:username\\",
218+
\\"operations\\": [
219+
\\"create\\",
220+
\\"update\\",
221+
\\"delete\\",
222+
\\"read\\"
223+
]
224+
}
225+
]
226+
}
227+
}
228+
],
229+
\\"primaryKeyInfo\\": {
230+
\\"isCustomPrimaryKey\\": false,
231+
\\"primaryKeyFieldName\\": \\"id\\",
232+
\\"sortKeyFieldNames\\": []
233+
}
234+
}
235+
},
236+
\\"nonModels\\": {},
237+
\\"enums\\": {
238+
\\"ConversationMessageSender\\": {
239+
\\"name\\": \\"ConversationMessageSender\\",
240+
\\"values\\": [
241+
\\"user\\",
242+
\\"assistant\\"
243+
]
59244
}
60245
},
246+
\\"conversation\\": {
247+
\\"modelName\\": \\"ConversationPirateChat\\"
248+
},
61249
\\"message\\": {
250+
\\"modelName\\": \\"ConversationMessagePirateChat\\",
62251
\\"send\\": {
63252
\\"name\\": \\"pirateChat\\",
64253
\\"isArray\\": false,
@@ -82,13 +271,13 @@ exports[`Conversation Route Introspection Visitor Metadata snapshot should gener
82271
\\"subscribe\\": {
83272
\\"isArray\\": false,
84273
\\"isRequired\\": false,
85-
\\"name\\": \\"onAssistantMessageResponsepirateChat\\",
274+
\\"name\\": \\"onAssistantMessageResponsePirateChat\\",
86275
\\"type\\": {
87-
\\"model\\": \\"ConversationMessagepirateChat\\"
276+
\\"model\\": \\"ConversationMessagePirateChat\\"
88277
},
89278
\\"arguments\\": {
90-
\\"sessionId\\": {
91-
\\"name\\": \\"sessionId\\",
279+
\\"conversationId\\": {
280+
\\"name\\": \\"conversationId\\",
92281
\\"isArray\\": false,
93282
\\"isRequired\\": true,
94283
\\"type\\": \\"ID\\"

0 commit comments

Comments
 (0)