Inspired by #800
NOTE: I won't be personally building this anytime soon. I WILL, however, gladly review any pull requests that adds this feature 😄
Right now, the apollo-language-server runs a set of validation rules against operations (great, right??).
In certain circumstances (like if you're running a relay project), you may want to disable existing validations or add new ones (like requiring an id on every object type for caches).
Since the apollo.config.js is an executable file, not just a static configuration, we can actually add these validations to it to run against client projects!
Here's my proposed API:
// apollo.config.js
const { defaultValidationRules } = require('apollo/lib/defaultValidationRules')
const relayValidationRules = require('my-custom-validation-rules')
module.exports = {
client: {
validationRules: [
relayValidationRules,
...defaultValidationRules.filter(removeBitsThatMessUpRelay)
]
}
}
This way, you'd have full control (for better or worse 😉) over validation rules, rather than just enabling/disabling rules from graphql-js
This would require changes to:
- apollo-language-server
- add validation overrides to the config/validation
- apollo
- export the default validation rules for easy import
Inspired by #800
Right now, the
apollo-language-serverruns a set of validation rules against operations (great, right??).In certain circumstances (like if you're running a relay project), you may want to disable existing validations or add new ones (like requiring an
idon every object type for caches).Since the
apollo.config.jsis an executable file, not just a static configuration, we can actually add these validations to it to run against client projects!Here's my proposed API:
This way, you'd have full control (for better or worse 😉) over validation rules, rather than just enabling/disabling rules from graphql-js
This would require changes to: