Conversation
The bundled AppSync schema validator declared these Merged API directives only on the OBJECT location, rejecting valid schemas that apply them to fields. AWS's Merged API devguide explicitly documents these directives on "types/fields" and shows field-level usage in official examples (e.g. `getMessage(id: ID!): Message @renamed(to: ...)`). Closes #13533
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughThe PR expands three AppSync Merged API directives ( ChangesAppSync Merged API Directive Expansion
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit fab8b24. Configure here.
Summary
The bundled AppSync schema validator declares the Merged API directives
@canonical,@hidden, and@renamedonly on theOBJECTlocation, causing valid schemas that apply them to fields to be rejected at packaging time:AWS's Merged API devguide explicitly documents these directives as applying to "types/fields" and shows field-level usage in official examples, e.g.:
This change extends each of the three directive declarations to
OBJECT | FIELD_DEFINITION, matching AWS's documented surface.Changes
packages/serverless/lib/plugins/aws/appsync/resources/Schema.js— broaden@canonical/@hidden/@renameddirective locations toOBJECT | FIELD_DEFINITION.packages/serverless/test/unit/lib/plugins/aws/appsync/graphql-tools-merge-compat.test.js— keep inlineAWS_TYPEScopy in sync.packages/serverless/test/unit/lib/plugins/aws/appsync/schema.test.js+ newfixtures/schemas/merged-api/schema.graphql— regression test that runs the directives throughSchema.generateSchema()(which callsvalidateSDL) on bothOBJECTandFIELD_DEFINITION.Out of scope
AWS's actual
@renameddirective takes a requiredto: String!argument (@renamed(to: "newName")). Adding that argument to the local declaration would be a breaking change for any user currently relying on the lenient bare@renamedpermitted by today's stub, so it is intentionally not part of this fix and should be addressed separately.Test plan
schema.test.js,graphql-tools-merge-compat.test.js)@canonicaland@hiddenonFIELD_DEFINITIONpackages successfully against the source buildCloses #13533
Summary by CodeRabbit
New Features
Tests
Note
Low Risk
Low risk: expands local AppSync directive stubs used for SDL validation and adds regression tests/fixtures; no runtime behavior or data handling changes beyond schema validation acceptance.
Overview
AppSync schema validation now accepts Merged API directives
@canonical,@hidden, and@renamedon bothOBJECTandFIELD_DEFINITION, preventing packaging failures for schemas that annotate fields.Adds a new merged-API schema fixture and a unit test to ensure
Schema.generateSchema()validates successfully with these directives applied at field level, and updates the merge compatibility test’sAWS_TYPESstub to match.Reviewed by Cursor Bugbot for commit fab8b24. Bugbot is set up for automated code reviews on this repo. Configure here.