Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readOnly and writeOnly not respected with allOf #176

Open
machitgarha opened this issue Aug 20, 2022 · 3 comments
Open

readOnly and writeOnly not respected with allOf #176

machitgarha opened this issue Aug 20, 2022 · 3 comments

Comments

@machitgarha
Copy link

If you have something like this:

type: object
required: [id]
properties
  id:
    allOf:
      - $ref: "#/id"
      - readOnly: true

then not passing "id" through a write request (e.g. POST) is not possible.

@pjordaan
Copy link

pjordaan commented Sep 8, 2022

I thought you could not extend reference in OpenAPI like this:

https://swagger.io/docs/specification/using-ref/

It says 'Any sibling elements of a $ref are ignored.'

@machitgarha
Copy link
Author

machitgarha commented Sep 8, 2022

@pjordaan, this is not a sibling. A sibling has to be on the same object, but in allOf, they are parts of two different array elements. You can see a valid example here:

https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/#allof

@pjordaan
Copy link

pjordaan commented Sep 8, 2022

ah sorry I overlooked the - before readOnly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants