amplify-codegen icon indicating copy to clipboard operation
amplify-codegen copied to clipboard

fix: Swift - Generate schema for non-models containing models correctly

Open MorFix opened this issue 2 years ago • 1 comments

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 test passes
  • [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.

MorFix avatar Jul 12 '23 16:07 MorFix

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.

dpilch avatar Sep 26 '23 20:09 dpilch