Skip to content

Conversation

jan-osch
Copy link

Problem

This PR adds test coverage for nested custom type references with required arrays in custom operations. While investigating related issues around custom type input generation, we identified gaps in test coverage for complex nested scenarios that could lead to regressions.

Issue number, if available: Related to #570 and #547

Changes

  • Added test case for nested custom type containing array fields with enum references
  • Added test case for custom type with required array of custom type references
  • Updated existing test to use simpler point custom type structure
  • Tests verify that input type generation preserves nested structure and array requirements correctly

These tests ensure the schema processor handles complex nested custom type scenarios properly when generating GraphQL input types for custom operations, particularly around the constructNonScalarFieldDefinition function and generateInputTypes logic.

Corresponding docs PR, if applicable: N/A

Validation

  • Added unit tests with snapshot validation for nested custom type input generation
  • Tests verify correct GraphQL schema generation for complex nested structures
  • Validates that array requirements and type references are preserved through nested levels
  • Similar to the approach used in PR #552 which fixed input type array handling

Checklist

  • If this PR includes a functional change to the runtime or type-level behavior of the code, I have added or updated automated test coverage for this change. (see Testing Strategy README)
  • If this PR requires a docs update, I have linked to that docs PR above.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jan-osch jan-osch requested a review from a team as a code owner August 15, 2025 14:47
Copy link

changeset-bot bot commented Aug 15, 2025

🦋 Changeset detected

Latest commit: 90ee2d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/data-schema Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ahmedhamouda78
Copy link
Member

Hello @jan-osch, thank you for the PR! We are currently in the process of reviewing another PR for the same issue (#619). We will let you know once we have any new updates regarding this issue.

): { type: 'ref'; link: string; required?: boolean; array?: boolean; arrayRequired?: boolean } => {
const {valueRequired, array, arrayRequired} = fieldDef.data;

const customTypeData: { type: 'ref'; link: string; required?: boolean; array?: boolean; arrayRequired?: boolean } = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we define a type and use it here instead of typing this inline? Also, did you consider the existing types and see if you can reuse them?

@ahmedhamouda78
Copy link
Member

Hello @jan-osch, since the author of the other PR (#619) is not responding, we will gladly consider your PR. Can you please address my comment and add more tests similar to the other PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants