Skip to content

readOnly property on object is ignored #830

Closed

Description

@christina-gagnon-sp

Describe the bug

Object still appears in request schema when readOnly property is set to true at the object level.

Expected behavior

The entire object should be excluded from the request schema when readOnly property is set to true at the object level. ReDoc renders the schema correctly, so it appears to be a Docusaurus issue.

Current behavior

readOnly is set to true on the ownerRefobject, but the ownerRef object is still visible in the request schema.

Possible solution

Steps to reproduce

  1. Set readOnly: true at object level in schema
  2. Object still appears in request schema
ownerRef:
    type : object
    readOnly: true
    description: >-
      The owner of this template, and the owner of campaigns generated from this template via a schedule. This field
      is automatically populated at creation time with the current user.
    properties:
      id:
        type: string
        description: Id of the owner
        example: 2c918086676d3e0601677611dbde220f
      type:
        type: string
        enum:
          - IDENTITY
        description: Type of the owner
        example: IDENTITY
      name:
        type: string
        description: Name of the owner
        example: Mister Manager
      email:
        type: string
        description: Email of the owner
        example: [email protected]

Screenshots

image

image

Context

We need to be able to exclude entire objects, not just individual properties from the request schema.

Your Environment

  • Version used: 2.4.3
  • Environment name and version: node.js v20.12.2, npm 10.5.0, python 3.12.3
  • Operating System and version (desktop or mobile): Win 11 Pro

Activity

  1. added
    bug
    on May 22, 2024
  2. JaimeOVasconcelos commented on May 27, 2024

    @JaimeOVasconcelos

    I have reported the same problem:

    My workaround was creating a Python script to create a new OpenAPI spec with components split into a version for requests (without readOnly properties) and another for responses (that can have the readOnly properties).
    Then, I built the documentation from the new OpenAPI spec, and it worked fine.
    I hope it helps you @christina-gagnon-sp.

    Jaime

  3. sserrata commented on Jun 24, 2024

    @sserrata
    Member

    Hi @christina-gagnon-sp, can you try installing 0.0.0-726 canary release to see if the issue has been resolved? Thanks!

  4. sserrata commented on Jun 28, 2024

    @sserrata
    Member

    Confirmed fix works as expected using the example provided in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions