graphql-to-json-schema
graphql-to-json-schema copied to clipboard
ID scalar is wrongfully declared with "type": "object"
According to the specification the ID scalar can be "integer" or "string" when used as an input and only "string" when used as an output: https://spec.graphql.org/June2018/#sec-ID
Currently it's represented as "type": "object" in the JSON schema which seems wrong. In my opinion it should be "type": ["string", "integer"] Kind of hard to decide which is more appropriate, since the possible values change depending on the usage of the scalar as either input or output. However ["string", "integer"] seems a lot closer to the specification than "object".
Can you please:
- Provided a small sample SDL that will replicate what you're talking about
- Provide the output you're seeing from using that SDL
- Provide the output you're expecting
@newhouse like for nullable array, we could have an option like IdTypeMapping: 'string' | 'integer' = 'string'
to specify which type should ID
resolve to.
wdyt?
Hi, is there an ETA for this? could this be fixed? also i'm trying to fix it now by reading code
i think this line should be 'string' instead of 'object', am i correct? https://github.com/charlypoly/graphql-to-json-schema/blob/4e809f8b4d595eb22779d329c65cbfd050357b52/lib/reducer.ts#L207
working on this.
@yairyairyair @tobias-tengler This is done and released in [email protected]