graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
16.09k stars 1.72k forks source link

Support custom Scalar URLS #2386

Open acao opened 2 years ago

acao commented 2 years ago

In terms of using custom scalars by URL, we have support now for specifiedBy directive!

Now users can host common scalar definitions, etc.

Any tickets you see that ask about using some custom, non-spec scalar type, whether closed or open tickets, should all be directed to this ticket.

Here is the spec: http://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars

so this works as long we use specifiedBy (SDL) or specifiedByURL in the introspection query (how should we expose adding this field in graphiql? or add it every time? is it there already).

If this is in the schema, then the inline variable validation should work automatically based on our usage of graphql validate(). However, in both codemirror-monaco and monaco-graphql we have more specific logic for validation of variable scalar values that will need to be tweaked for both plugins.

acao commented 2 years ago

We could support these custom scalars that match up with different specs!

https://www.graphql-scalars.dev/docs/scalars/json-object