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

flag to support buildSchema assumeValidSDL param #57

Merged
merged 1 commit into from
May 5, 2022

Conversation

SamuelGHill
Copy link
Contributor

Allows for custom types and directives to be involved in a schema. Is currently supported in graphql BuildSchema --> graphql/graphql-js#1854 (comment)

I am using gql-generator to build out query samples, and we use custom types and directives in our schemas. We do not need the validator.

With this PR, the CLI can add this flag, --assumeValid true

gqlg --schemaFilePath index.graphql --destDirPath ./example/output --depthLimit 5 --assumeValid true

Error: Unknown directive "@rest".
    at assertValidSDL (/Users/samuelhill/Desktop/app/node_modules/graphql/validation/validate.js:135:11)
    at buildASTSchema (/Users/samuelhill/Desktop/app/node_modules/graphql/utilities/buildASTSchema.js:44:34)
    at buildSchema (/Users/samuelhill/Desktop/app/node_modules/graphql/utilities/buildASTSchema.js:109:10)
    at Object.<anonymous> (/Users/samuelhill/Desktop/app/node_modules/gql-generator/index.js:28:19)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

@SamuelGHill
Copy link
Contributor Author

Passes tests -->

$ npm run test

> [email protected] test
> mocha -u qunit



  ✓ validate generated queries (246ms)
  ✓ limit depth (338ms)
  ✓ excludes deprecated fields by default (180ms)
  ✓ includes deprecated fields with includeDeprecatedFields flag (172ms)
  ✓ includes nested in union types (179ms)

  5 passing (1s)

@timqian timqian merged commit d875ebf into timqian:master May 5, 2022
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