Skip to content

Read-only but required fields are defined as pointers #778

@acabarbaye

Description

@acabarbaye

In Open Api spec, https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#fixed-fields-20, there is the following statement:

If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only.
Therefore, if a field is set as required and readOnly, it should not be considered as optional in the type used by server stubs since it must be in the response.

Since #547 however, all read-only fields have been defined as pointers in the generated types even if there are in the required list. Could we make the generation of types different whether it is for consumption by clients or by servers so that, the presence of required read-only fields is enforced in response and required write only-fields in requests?

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