-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Description
OpenAPI properties may be nullable & required. required only indicates that a key must be present in an object to be valid, it makes no restriction on the type of the value corresponding to that key. openapi-to-graphql assumes that required OpenAPI properties are non-nullable:
openapi-to-graphql/packages/openapi-to-graphql/src/schema_builder.ts
Lines 622 to 623 in a06d6f4
| const requiredProperty = | |
| typeof def.required === 'object' && def.required.includes(fieldTypeKey) |
To Reproduce
Use openapi-to-graphql on a spec with type with a required field that is also nullable. Queries for that type which return a null for that nullable field cause unexpected validation errors.
Expected behavior
No validation errors when returning nulls for explicitly nullable fields.
nicolasparada
Metadata
Metadata
Assignees
Labels
No labels