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

Feat: allow customtypes ref in arguments/main #497

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vaisshnavi7
Copy link
Contributor

Description of changes: This PR allows the use of CustomType and RefType in arguments for custom operations in the @aws-amplify/data-schema package. The changes span across three main areas, building upon the work done in PRs #402 and #412 :

  1. Updated CustomOperation.ts to accept CustomType and RefType in CustomArguments.
  2. Modified bridge-types.ts to include CustomType and RefType in relevant interfaces.
  3. Added type tests in CustomOperations.test-d.ts to verify the new functionality.
  4. Improved type resolution logic in ClientCustomOperations.ts for new argument types.
  5. Updated SchemaProcessor.ts to:
  • Handle customType and ref arguments in custom queries and mutations.
  • Generate separate GraphQL input types for non-scalar arguments.
  • Ensure correct referencing of these input types in the generated GraphQL operations.
  • Support nested custom types and combinations of scalar and non-scalar arguments.

Key Implementations:

  • Allow custom types, nested types, and references in query/mutation arguments.
  • Generate separate input types for non-scalar arguments in GraphQL schema.
  • Correctly reference these input types in operation definitions.
  • Handle both scalar and non-scalar arguments appropriately.
  • Support nested custom types and complex argument structures.

Testing:

  • Added new type tests in CustomOperations.test-d.ts
  • Implemented client operation tests with mocked runtime behavior in custom-operations.ts for:
    • Custom queries with custom type arguments
    • Custom queries with ref arguments
    • Custom mutations with custom type arguments
    • Custom mutations with ref arguments- Updated test snapshots to reflect new schema generation behavior
  • Deployed sample application to verify schema generation and successful deployment

These changes enhance the flexibility of schema definitions by allowing more complex argument structures in custom operations.
This PR replaces #387 and includes the same changes, but with a branch name that matches the required pattern for the preid build process.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Jan 10, 2025

🦋 Changeset detected

Latest commit: 2e81a9d

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 Minor

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

@vaisshnavi7 vaisshnavi7 changed the title Feat/allow customtypes ref in arguments/main Feat: allow customtypes ref in arguments/main Jan 10, 2025
@vaisshnavi7 vaisshnavi7 marked this pull request as ready for review January 10, 2025 20:23
@vaisshnavi7 vaisshnavi7 requested review from a team as code owners January 10, 2025 20:23
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