Skip to content

readOnly is ignored in component schemasΒ #581

@alex-albericio

Description

@alex-albericio

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

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