-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v20.12.1
Amplify CLI Version
12.14.2
What operating system are you using?
Mac
Amplify Codegen Command
codegen
Describe the bug
Generated types of nested arrays of a custom type are not correct.
Say I have this in my schema.graphql
type Foo {
nestedArray: [[Bar!]!]!
}
type Bar {
bool: Boolean
}
and I run amplify codegen, I get the following in API.ts
export type Foo = {
nestedArray: Array<{
__typename: "Bar";
bool?: boolean | null;
}>;
}
export type Bar = {
__typename: "Bar";
bool?: boolean | null;
};
Expected behavior
export type Foo = {
nestedArray: Array< Array<{
__typename: "Bar";
bool?: boolean | null;
}> >;
}
export type Bar = {
__typename: "Bar";
bool?: boolean | null;
};
Reproduction steps
- Add this to schema.graphql
type Foo {
nestedArray: [[Bar!]!]!
}
type Bar {
bool: Boolean
}
- Run
amplify codegen
- See generated types in API.ts
GraphQL schema(s)
type Foo {
nestedArray: [[Bar!]!]!
}
type Bar {
bool: Boolean
}
Log output
# Put your logs below this line
Additional information
Nested arrays of primitive types are being generated fine. Running codegen on
type Foo {
nestedArray: [[String!]!]!
}
I get
export type Foo = {
nestedArray: Array<Array<string>>;
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working