Skip to content

Support nullable & optional/required #542

@raderio

Description

@raderio

In GraphQL we can mark a field that it is nullable or not by "!". But how to also mark that a field is required or optional?

Required means that this parameter must be passed, even if it is null.

Basically null has the meaning of "this property existed before, and I want to nullify its value". If there's no value, or the value needs not change (for requests, for example), it just shouldn't be sent.

For example an user have a birth day set in his profile, if he wants to update the birth day he must pass a value, but it is not allowed to pass null.

So, in this case a birth day type is not nullable, but it is optional, or user send a valida value or just not send this parameter.

This is supported by OpenAPI https://swagger.io/docs/specification/data-models/data-types/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions