-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support @oneOf
directive spec
#3768
Comments
Quick note: oneOf support was added to ValuesOfCorrectTypeRule by @erikkessler1 — see graphql/graphql-js#3513 |
@yaacovCR ah great, I assumed I had just overlooked this, keyword search failed me! |
Having a strange issue with this rule in some cursory testing, whilst trying to get validation working const errors = validate(schema, ast, rules);
console.log({ errors, rules }); using this version: |
One thing to keep in mind during this is that even when all fields are nullable variables, |
@benjie awesome! these directives work automatically for now because of introspection, but I will keep that in mind if we need the actual directive definition types in the future. when i wrote this I had forgotten this!
great points! i was thinking something like the latter. for now I can make a PR if they have time to merge it. we really need to take over or replace explorer as there are some huge a11y issues that need addressed as well |
The
@oneOf
spec is well past the level of maturity we require, and has already made it's way intographql-js
releases 😍 Input polymorphism was the first goal I had when joining the graphql project in 2018, and the spec developers have done a wonderful job of advancing this and it's predecessors!We just need to introduce support in a few places to enable this spec across our monorepo.
Cross-ecosystem User Outcomes
@oneOf
in completion as a built-in directive on Input Type Definitions (can we make all graphql-js spec directives always show up where they should be automatically somehow? currently each spec directive is added to completion manually iirc)@oneOf
enabled operation arguments should show all available fields at first as it does currently, but if a user tries to add more fields for the input type, no completion appears.@oneOf
input type. I hope that this might prevent any confusion with the input type argument completion, for users who aren't familiar with@oneOf
yet and/or aren't aware that input types are@oneOf
in the schema, which could be likely if their work is client focused.graphql-js
rule that needs to be written (may contrib for this effort!) (correct me if I'm wrong!)variablesToJsonSchema()
which is used formonaco-graphql
and will be used for codemirror 6 needs to support@oneOf
via... you guessed it...oneOf
😆 which we are putting the finishing touches on forcodemirror-json-schema
for the cm6 graphql experience!GraphiQL-specific User Outcomes
@oneOf
graphiql-explorer
should honor@oneOf
when building queries as well? I have a PR to merge the onegraph graphiql-explorer into our repo and convert it to typescript. They said it was ok to do, but not reccomended, but in the absence of any new plugin to replace it, and with additional a11y needs, it's likely this will happen by graphiql@5.0.0 if not sooner, thus we should be able to add this as wellThe text was updated successfully, but these errors were encountered: