Skip to content

[Feature Request] Mark nonnullable attributes as required in RESTApiHandler get requests #1744

@thomassnielsen

Description

@thomassnielsen

When using the RESTApiHandler and OpenAPI plugin, the return types for attributes in a get request are currently all optional (<type> | undefined). Since JSON:API responses always include all the attributes, they should not be marked as optional. This can be achieved with listing the attributes in a required array in the openapi schema.

Basically what we want is for the attributes to go from e.g.

Before

{
  myString: string | undefined
  myNullableString: string | null | undefined
}

After

{
  myString: string
  myNullableString: string | null
}

See Discord discussion for more details.

This change does not apply to RPCApiHandler since it allows selecting which attributes to return, so they're all optional in practice.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions