grantila / typeconv

Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
MIT License
421 stars 8 forks source link

json-schema type alias translates to union in GraphQL #7

Open mdesousa opened 3 years ago

mdesousa commented 3 years ago

Hi, one additional issue... when you have a type definition in json-schema like this:

"DateTimeIso8601": {
  "type": "string",
  "description": "A datetime in ISO-8601 format (YYYY-MM-DDTHH:MM:SS.MMMZ)",
  "format": "date-time"
}

It results in a union of String in graphql, like this: union DateTimeIso8601 = String This is invalid graphql and results in an error:

Union type DateTimeIso8601 can only include Object types, it cannot include String.

Thanks

grantila commented 3 years ago

Thanks, will fix this!