Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix bug with missing arrays and requireds in custom operation args #552

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shaneargo
Copy link

Problem

Fixes issue #546 in which arguments to custom operations would ignore arrays and requireds in both the arguments themselves and in the fields of custom types used as arguments.

Issue number: #546

Changes

  • Adds tests to verify the schema output matches expectations
  • Modified the generation of the schema for Input types:
    • Added arrays and requireds to the code that handles custom types
    • Added arrays and requireds to the code that handles enums

The code that adds the square brackets and exclamation marks is copied and pasted. I had considered abstracting this into a separate function, however there are a number of locations throughout SchemaProcessor.ts where this code is repeated, so I decided to keep it consistent.

Validation

I've added a number of unit tests to cover pretty much all combinations of objects/enums/arrays/required. (Perhaps too many?)

I wasn't sure that this was the best file to add the tests to. Please let me know if you'd like this changed.

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.

…guments

Fixes issue aws-amplify#546 in which arguments to custom operations would ignore arrays and
requireds in both the arguments themselves and in the fields of custom types used
as arguments.

This adds a bunch of tests to verify the schema output matches expectations and
the code changes required to fix the bug.
@shaneargo shaneargo requested a review from a team as a code owner March 10, 2025 06:24
Copy link

changeset-bot bot commented Mar 10, 2025

🦋 Changeset detected

Latest commit: 534ee24

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

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.

1 participant