You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
18.18.2
Amplify CLI Version
12.10.1
What operating system are you using?
Mac
Amplify Codegen Command
codegen
Describe the bug
When we run Amplify codegen setup for Angular, we are getting incorrect __typename generation. Currently, on a single type only, we are getting __typename: string instead of __typename: 'TypeName'
Expected behavior
When we generate Angular Code with Codegen, the __typename should be set to the name of the custom type it belongs too
Reproduction steps
Run Amplify CodeGen with the schema listed below.
GraphQL schema(s)
# Put schemas below this linegetWidgets: [WidgetDefnition]
enumWidgetType {
ReportingLocationTrendsWidget ReportingLocationTimeSeriesWidget ReportingLocationKPIGaugeWidget ReportingLocationMultiTrendGraphWidget GaugeLocationsWidget
}
enumFlowDirection {
IN OUT
}
interfaceWidget {
id: IDorder: Intwidget_type: WidgetTypename: Stringintent_id: String # if associated to an intentrows: Stringcolumns: String
}
enumWidgetType {
ReportingLocationTrendsWidget ReportingLocationTimeSeriesWidget ReportingLocationKPIGaugeWidget ReportingLocationMultiTrendGraphWidget GaugeLocationsWidget
}
unionWidgetDefinition = ReportingLocationKPIGaugeWidget | ReportingLocationMultiTrendGraphWidgettypeReportingLocationKPIGaugeWidgetimplementsWidget {
id: IDorder: Intwidget_type: WidgetTypename: Stringintent_id: Stringrows: Stringcolumns: Stringcapability_id: Stringtransformer_id: Stringseries_key: Stringaggregator: TimeSeriesWidgetAggregatorgaugeType: KPIGaugeType,
min: Float,
max: Float
}
typeGaugeLocationsWidgetimplementsWidget {
id: IDorder: Intwidget_type: WidgetTypename: Stringintent_id: Stringrows: Stringcolumns: Stringflow_direction: FlowDirectionlocations: [GaugeLocation!]!
}
typeGaugeLocation {
name: Stringlabel: Stringoffset: Intcolor: String
}
enumTimeSeriesWidgetTimeUnit {
HOUR DAY WEEK MONTH YEAR
}
enumTimeSeriesWidgetAggregator {
MAX MIN AVG
}
enumKPIGaugeType {
NUMBER_VALUE GAUGE
}
enumDashboardWidgetLayout {
CLASSIC GRID
}
enumFlowDirection {
IN OUT
}
Log output
# Put your logs below this line
✔ Generated GraphQL operations successfully and saved at src/graphql
✔ Code generated successfully and saved in file src/app/services/api.service.ts
Additional information
Right now, everything compiles and deploys correctly if we manually modify api.service.ts to update
When we isolate GaugeLocation as the only type in the Union, the corresponding code in api.service is generated correctly. However, as soon as we add 2nd type to the Union it fails.
If we remove GaugeLocation from the union altogether, all types in the union generate successfully.
The only difference between GaugeLocation and the rest of the type definitions is it has a complex type for one of its properties.
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
18.18.2
Amplify CLI Version
12.10.1
What operating system are you using?
Mac
Amplify Codegen Command
codegen
Describe the bug
When we run Amplify codegen setup for Angular, we are getting incorrect __typename generation. Currently, on a single type only, we are getting __typename: string instead of __typename: 'TypeName'
Expected behavior
When we generate Angular Code with Codegen, the __typename should be set to the name of the custom type it belongs too
Reproduction steps
Run Amplify CodeGen with the schema listed below.
GraphQL schema(s)
Log output
Additional information
Right now, everything compiles and deploys correctly if we manually modify api.service.ts to update
__typename: string --> __typename: 'GaugeLocation'
This is working correctly for our other 75+ types and inputs but this one set is causing the issue.
.graphqlconfig.yml
api.service
The text was updated successfully, but these errors were encountered: