amplify-codegen
amplify-codegen copied to clipboard
fix: Swift - Generate schema for non-models containing models correctly
Description of changes
If a schema contains non-models types that contain models, they're not generated correctly in Swift, because of a missing label, and the code doesn't compile. That scenario can happen if you have a custom resolver that returns a model along with other things.
Issue #, if available
-N/A-
Description of how you validated changes
- Added test
- Generated models locally
Checklist
- [X] PR description included
- [X]
yarn testpasses - [X] Tests are changed or added
- [X] Changes are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modified
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Thanks for the contribution @MorFix. Could you also add this test schema here: https://github.com/aws-amplify/amplify-category-api/blob/main/packages/amplify-graphql-schema-test-library/src/index.ts#L39
This will add this schema to our E2E tests that will test for successful compilation of the generated models.