Skip to content

Flag to force required in requests/responses #2300

@eduardheller

Description

@eduardheller

Description

Hi,

It would be great to have the option to force fields to be required when none are explicitly marked as required (i.e., required: []).

In my project, the backend responses don’t consistently set fields as required, and this leads to a lot of overhead checking for undefined values in the response objects.

The idea is to introduce a flag that forces fields in responses or requests to be treated as required by default—similar to what is shown in this pull request:
openapi-ts/openapi-typescript#1621

It would be nice to have something like this in the config:

  • responsesPropertiesRequiredByDefault
  • requestsPropertiesRequiredByDefault

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    RSVP 👍👎Explicit request for reactions to gauge interest in resolving this issuefeature 🚀New feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions