-
Notifications
You must be signed in to change notification settings - Fork 95
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
Lint for required fields [WIP] #50
Conversation
@rgoldfinger: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
@rgoldfinger i dont have a particularly strong opinion about this, but it would help me to see a couple of testcases to see how the API would work. the one time i have seen this is through apollo-client's addTypenameToSelectionSet where they force adding a particular field to the query because they need it for caching as well. however, they can safely assume that anecdotally speaking, we would use this to add |
}, | ||
}, | ||
create: context => { | ||
return createRule(context, optionGroup => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.options
has the options you want
This sounds good to me - I would love to use this option. |
Hey Jon! I got it working with the options and added some tests. I'll add some documentation and update the changelog after I get a 👍 on this approach. We also considered injecting the |
89dcac4
to
9dc6f5f
Compare
Ping @jnwng |
@rgoldfinger code looks good, but let me clear up the test issues first (something changed upstream) so you can rebase and we can make sure everything is passing before merging |
re: what we discussed offline, i pushed some changes to master to fix tests, so please rebase and resolve conflicts (you can probably just take my |
This looks like a great new feature! |
9dc6f5f
to
559f6e1
Compare
Rebased and updated with documentation |
thank you @rgoldfinger! |
We have a need to validate that the queries include a
uuid
field, since that's how we cache things client side. I thought I'd try to make this more generic, as a 'required field' lint rule that errors if the field is 1) present in the schema and 2) not requested in this query.Is this something that you think is worth including in this package?
Can you offer any guidance on how to pass the rule's options to the rule itself? The rule is invoked within graphql's
validate
, so I'm not seeing a clear way to do this.TODO: