-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: process input object, union and interface metadata in model intr…
…ospection schema codegen (#795) * fix: add input object metadata in model introspection schema * fix: use one place for types to skip * add e2e tests * fix CI failure * fix cleanup script * feat: add union and interface type in model intro schema * fix test description * fix e2e * rm unused code * fix: fine grain argument field type & better error msg for getType * fix: remove new types in field type * rename arguments to attributes * rm union and interface in root level schema * add unit test cases for list of scalar, enum and input
- Loading branch information
1 parent
3ef3e5d
commit 73e4520
Showing
15 changed files
with
1,114 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/amplify-codegen-e2e-tests/schemas/admin-modelgen.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY! | ||
|
||
type Todo @model { | ||
id: ID! | ||
name: String! | ||
description: String | ||
phone: Phone | ||
} | ||
type Phone { | ||
number: String | ||
} | ||
enum BillingSource { | ||
CLIENT | ||
PROJECT | ||
} | ||
input CustomInput { | ||
customField1: String! | ||
customField2: BillingSource | ||
customField3: NestedInput! | ||
} | ||
input NestedInput { | ||
content: String! = "hello" | ||
} | ||
interface ICustom { | ||
firstName: String! | ||
lastName: String | ||
birthdays: [INestedCustom!]! | ||
} | ||
interface INestedCustom { | ||
birthDay: AWSDate! | ||
} | ||
# The member types of a Union type must all be Object base types. | ||
union CustomUnion = Todo | Phone | ||
|
||
type Query { | ||
getAllTodo(msg: String, input: CustomInput): String @function(name: "echofunction-${env}") | ||
echo(msg: String!): String | ||
echo2(todoId: ID!): Todo | ||
echo3: [Todo!]! | ||
echo4(number: String): Phone | ||
echo5: [CustomUnion!]! | ||
echo6(customInput: CustomInput): String! | ||
echo7: [ICustom]! | ||
echo8(msg: [Float], msg2: [Int!], enumType: BillingSource, enumList: [BillingSource], inputType: [CustomInput]): [String] | ||
echo9(msg: [Float]!, msg2: [Int!]!, enumType: BillingSource!, enumList: [BillingSource!]!, inputType: [CustomInput!]!): [String!]! | ||
|
||
} | ||
type Mutation { | ||
mutate(msg: [String!]!): Todo | ||
} | ||
type Subscription { | ||
onMutate(msg: String): [Todo!] | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/amplify-codegen-e2e-tests/src/__tests__/push-codegen-admin-modelgen.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DEFAULT_JS_CONFIG, createNewProjectDir } from "@aws-amplify/amplify-codegen-e2e-core"; | ||
import { deleteAmplifyProject, testPushAdminModelgen, testPushCodegen } from "../codegen-tests-base"; | ||
|
||
const schema = 'admin-modelgen.graphql'; | ||
|
||
describe('Amplify push with codegen tests - admin modelgen', () => { | ||
let projectRoot: string; | ||
beforeEach(async () => { | ||
projectRoot = await createNewProjectDir('pushCodegenAdminModelgen'); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteAmplifyProject(projectRoot); | ||
}); | ||
|
||
it(`should not throw error for executing the admin modelgen step required by studio CMS usage post push given the schema with input, union and interface types`, async () => { | ||
await testPushAdminModelgen(DEFAULT_JS_CONFIG, projectRoot, schema); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.