Skip to content

Commit

Permalink
update conversation route return type to model
Browse files Browse the repository at this point in the history
  • Loading branch information
atierian committed Jul 24, 2024
1 parent 27bf11b commit c7f80b1
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@
"nonModel"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"interface": {
"type": "string"
}
},
"required": [
"interface"
],
"additionalProperties": false
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ exports[`Conversation Route Introspection Visitor Metadata snapshot should gener
"{
\\"version\\": 1,
\\"models\\": {},
\\"enums\\": {},
\\"enums\\": {
\\"ConversationMessageSender\\": {
\\"name\\": \\"ConversationMessageSender\\",
\\"values\\": [
\\"user\\",
\\"assistant\\"
]
}
},
\\"nonModels\\": {},
\\"conversations\\": {
\\"pirateChat\\": {
Expand Down Expand Up @@ -251,7 +259,9 @@ exports[`Conversation Route Introspection Visitor Metadata snapshot should gener
\\"send\\": {
\\"name\\": \\"pirateChat\\",
\\"isArray\\": false,
\\"type\\": \\"String\\",
\\"type\\": {
\\"model\\": \\"ConversationMessagePirateChat\\"
},
\\"isRequired\\": false,
\\"arguments\\": {
\\"sessionId\\": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,22 @@ const getVisitor = (schema: string, settings: any = {}, directives: readonly Dir

describe('Conversation Route Introspection Visitor', () => {
const schema = /* GraphQL */ `
enum ConversationMessageSender {
user
assistant
}
interface ConversationMessage {
id: ID!
sessionId: ID!
sender: ConversationMessageSender
content: String
context: AWSJSON
uiComponents: [AWSJSON]
}
type Mutation {
pirateChat(sessionId: ID, content: String): String
pirateChat(sessionId: ID, content: String): ConversationMessage
@conversation(aiModel: "Claude3Haiku", functionName: "conversation-handler")
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export type InputFieldType = ScalarType
export type FieldType = ScalarType
| { enum: string }
| { model: string }
| { nonModel: string };
| { nonModel: string }
| { interface: string };
export type FieldAttribute = ModelAttribute;
/**
* Input Definition
Expand Down
2 changes: 1 addition & 1 deletion packages/appsync-modelgen-plugin/src/validate-cjs.js

Large diffs are not rendered by default.

Loading

0 comments on commit c7f80b1

Please sign in to comment.