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

Triple quote string literal descriptions cause late validation failure #317

Closed
thomasmichaelwallace opened this issue Mar 25, 2020 · 3 comments

Comments

@thomasmichaelwallace
Copy link
Contributor

First- thanks for all the work on this ace project!

AppSync's support for the GraphQL SDL is a little out of date. Specially it doesn't support string literals (triple quote) as descriptions: aws/aws-appsync-community#38

If you use this now best practace approach with this plug-in the schema validates (because, well, it is valid!) but your deployment will fail with:

ServerlessError: An error occurred: GraphQlSchema - Schema Creation Status is FAILED with details: Failed to parse schema document - ensure it's a valid SDL-formatted document..

Luckily I was aware of this problem, so I didn't lose too much time. But I think it would be nice if this plugin either:

  1. Automatically stripped triple quote string literals before deploying the stitched schema [preferred]
  2. Failed validation if the schema includes triple quote string literals.
@thomasmichaelwallace
Copy link
Contributor Author

As part of my own deployment I'm solving the problem by pre-processing (removing the offending descriptions).

I'm more than happy to fold this into a PR if you agree it's something that should be part of this plugin.

@thomasmichaelwallace
Copy link
Contributor Author

thomasmichaelwallace commented Mar 25, 2020

For reference, this is what I needed to do get my schema to pass appsync's internal definition:

const conformSchema =
  (schema) => schema
    .replace(/"""[^"]*"""\n/g, '') // appsync does not support the new style descriptions
    .replace(/#.*\n/g, '') // appysnc does not support old-style # comments in enums, so remove them all
    .replace(/ *& */g, ', ') // appsync does not support the standard '&', but the "unofficial" ',' join for interfaces

@bboure
Copy link
Collaborator

bboure commented Dec 19, 2020

Fixed in #340

@bboure bboure closed this as completed Dec 19, 2020
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

No branches or pull requests

2 participants