-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Validation Too Strict for Custom Scalars #1705
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
Comments
hey, good question! maybe instead it could provide a warning, such as how vscode gives a warning squiggle for also of interest, there is a 2nd stage draft spec for Custom Scalar Definitions that are hosted via URIs: there is also this successor to the |
@acao Thanks for the input, I haven't seen those RFCs before. I think in the case of a custom scalar it would be an explicit "any" because the variable editor knows it's a custom scalar and unfortunately we can't perform any validation beyond this and have to assume it's valid. |
personally, i feel it's best to make it invalid by default until we adopt the custom scalars spec. otherwise it's a breaking change. i prefer it to be invalid by default, because |
do you mind if i turn this into a feature request to support the custom scalar spec? otherwise, it makes the most sense to mark this as a |
I too am facing this issue as one of my field is of type AnyScalarGraphType. Graphiql shows the warning : Expected value of type "_Any". Shouldn't AnyScalarGraphType be included as a valid scalar type? |
@truptivishe-gep |
closing this as a dupe because it's another request for validating the Any scalar/non-spec scalars graphiql is a to-spec tool used for specification development, and closely aligned with |
Custom Scalars is GraphQL's only way of providing flexible input types. As it should be, there is no validation for these in the main editor. In the variable editor however, a custom scalar is only allow to be a string, number, boolean, or null. Anything else throws an error. If I need a free form object in the variable editor, it will complain. Could we make a non-breaking change and remove validation for custom scalars here to be more consistent and flexible, allowing free form object types? (by removing
type instanceof GraphQLScalarType
)graphiql/packages/codemirror-graphql/src/variables/lint.js
Lines 165 to 174 in fa5fe7e
The text was updated successfully, but these errors were encountered: