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 is ignored in component schemas #581

Closed
alex-albericio opened this issue Oct 5, 2021 · 3 comments
Closed

readOnly is ignored in component schemas #581

alex-albericio opened this issue Oct 5, 2021 · 3 comments

Comments

@alex-albericio
Copy link

alex-albericio commented Oct 5, 2021

Hi!

First of all, congratulations on building such an excellent tool! 👏👏👏

We have some models that are only be meant to appear in responses, never in requests. These components are marked as readOnly in their schemas, such as:

components:
  schemas:
    Holder:
      type: object
      properties:
        id:
          type: integer
        ro:
          $ref: '#/components/schemas/ReadOnlyComponent'
    ReadOnlyComponent:
      type: object
      readOnly: true
      properties:
        id:
          type: integer

The problem is that, if we use Holder in the requestBody, the property "ro" appears in the visualisation of the request body schema. This is similar to #569, but not exactly the same.

In Swagger-UI the schema is rendered as expected; the "ro" field is hidden in the POST operation but visible in the GET.

Swagger-UI example
RapiDoc example

Using RapiDoc 9.1.3

@mrin9
Copy link
Collaborator

mrin9 commented Oct 7, 2021

thanks for reporting and putting up the examples easier for us to start working
will get to it soon

@mrin9 mrin9 closed this as completed in c842e1c Oct 11, 2021
@mrin9
Copy link
Collaborator

mrin9 commented Oct 11, 2021

here is the test-case

https://mrin9.github.io/RapiDoc/examples/readwrite.html

pick the beta build form dist/rapidoc-min.js to test it locally

@alex-albericio
Copy link
Author

Awesome! Thank you very much for the quick fix @mrin9. I've tested it with our API and it seems to be working fine 🙌

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