cjoudrey / graphql-schema-linter

Validate GraphQL schema definitions against a set of rules
MIT License
694 stars 62 forks source link

Don't limit amount of reported errors #309

Closed vojtech-dobes closed 2 years ago

vojtech-dobes commented 2 years ago

Fixes https://github.com/cjoudrey/graphql-schema-linter/issues/308

When our schema produced too many errors, graphql scream with following error:

Too many validation errors, error limit reached. Validation aborted.

Subsequent errors sorting trips over missing location in this error :).

maxErrors is documented specifically to not explode on crazy malicious queries, but considering purpose of this tool, raising maxErrors effectively to infinity should be valid.

cjoudrey commented 2 years ago

Thanks for the contribution @vojtech-dobes! Great find! This should help close https://github.com/cjoudrey/graphql-schema-linter/issues/308.

I see some tests are failing. We might want to address those.

vojtech-dobes commented 2 years ago

@cjoudrey I think I found it, there is difference in validate arguments in graphql@15.x and graphql@16.x. Let me know if solving it by checking import { version } from 'graphql' is okay.

cjoudrey commented 2 years ago

Good catch!

Yeah, I am fine with changing logic based on version. I'd make the default behaviour the v16 method signature. That way things continue to work for v17 and so on.

vojtech-dobes commented 2 years ago

@cjoudrey right - does it mean you want it further tweaked :)? I am not sure.

cjoudrey commented 2 years ago

I think what you did is fine. Thanks again for the contribution. I'll get this merged and released shortly. 😄

vojtech-dobes commented 2 years ago

@cjoudrey Thanks for accepting :)!