aws-amplify / aws-amplify/amplify-codegen
Migration to graphql v2 is creating an issue with capitalization of of non model type in schema.graphql . Unknown type "OvertimeDetailInput". Did you mean "overtimeDetailInput" or "overtimeDetail"?
- Dominant language
- TypeScript
- Stars
- 59
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
v14.17.4
### Amplify CLI Version
8.0.2
### What operating system are you using?
Ubuntu 20.04 on WSL
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
### Amplify Categories
api
### Amplify Commands
Not applicable
### Describe the bug
On migrating to new graphqlTransformer v2 it is causing issues with capitalization on an array of type in `schema.graphql` file. e,g
```graphql
type QuoteInfo @model{
id: ID!
overtimeDetails: [overtimeDetail]
}
type overtimeDetail {
multiplier: float
overtimeHours: float
}
```
This gives me the issue when mocking or pushing to backend of `Unknown type "OvertimeDetailInput". Did you mean "overtimeDetailInput" or "overtimeDetail"?`
From what I can see in API.ts file auto generated when using the old graphqltransformer v1, It has created the following types:
```ts
export type CreateQuoteInfoInput = {
id?: string | null,
overtimeDetails?: Array< OvertimeDetailInput | null > | null,
}
export type OvertimeDetailInput = {
multiplier?: number | null,
overtimeHours?: number | null,
}
export type UpdateQuoteInfoInput = {
id?: string | null,
overtimeDetails?: Array< OvertimeDetailInput | null > | null,
}
```
Note the capital `O` in `OvertimeDetailInput` above compared to the type `overtimeDetail ` as the type in `schema.graphql`. Also seeing `OvertimeDetailInput` in the auto generated `schema.json` at `src/graphql`
### Expected behavior
Error shouldn't occur when mocking or pushing to amplify backend.
### Reproduction steps
1. Create the schema above using graphql Transformer v1
2. amplify push
3. amplify migrate api
4. amplify mock
### GraphQL schema(s)
```graphql
# Put schemas below this line
type QuoteInfo @model{
id: ID!
overtimeDetails: [overtimeDetail]
}
type overtimeDetail {
multiplier: float
overtimeHours: float
}
```
### Log output
```
# Put your logs below this line
Failed to start API Mock endpoint Error: Unknown type "OvertimeDetailInput". Did you mean "overtimeDetailInput" or "overtimeDetail"?
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.