Skip to content

Add readyOnly/writeOnly support #807

@hactar

Description

@hactar

Motivation

Currently the generator does not support readOnly and writeOnly, which is present in both 3.0 and 3.1. These attributes can be useful when generating RESTful APIs, for example if you have an ID that is generated on the server, so when you POST, there should not be a required ID field. but when you GET, the ID field is required in the response. The result would be that the same component would sometimes have a field that is optional, and sometimes not, depending on usage context.

Proposed solution

I guess adding this is not trivial, the generator would have to generate two different versions of components, one for the request, and one for the response? Or would there be a smarter way of doing this?

Alternatives considered

No response

Additional information

Is there a way you people currently work around this? Do you manually maintain two versions of the same component in the yaml file for example?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions