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 fields not displayed in schema view #757

Closed
HansAarneLiblik opened this issue May 25, 2022 · 5 comments
Closed

Readonly fields not displayed in schema view #757

HansAarneLiblik opened this issue May 25, 2022 · 5 comments

Comments

@HansAarneLiblik
Copy link

I'm on RapiDoc v9.3.2

After upgrading, my UI changed from

image

to

image

As you can see, all the readonly fields are missing from output schema

@HansAarneLiblik
Copy link
Author

I think this is the culprit https://github.com/rapi-doc/RapiDoc/blob/v9.3.2/src/templates/expanded-endpoint-template.js#L111

schema-hide-read-only = "${path.isWebhook ? this.schemaHideReadOnly : false}"
should be
schema-hide-read-only = "${path.isWebhook ? false : this.schemaHideReadOnly}"

@mrin9
Copy link
Collaborator

mrin9 commented May 25, 2022

Is the Response in the screenshot is webhook/callback ?
also share what attributes are you using on RapiDoc

Is it possible for you to tell me how is it rendered on Swagger UI ?
for the context please refer to #727 why it changed

@HansAarneLiblik
Copy link
Author

It's not a webhook or a callback, just a normal Openapi schema

Swagger UI looks like this (Tried my schema in https://editor.swagger.io/)
image

@HansAarneLiblik
Copy link
Author

HansAarneLiblik commented May 25, 2022

This is my configuration

<rapi-doc
        id="semic-rapidoc-base"
        spec-url="{{ schema_url }}"
        use-path-in-nav-bar=true
        theme="light"
        load-fonts=false
        nav-item-spacing="compact"
        allow-spec-url-load=false
        allow-spec-file-load=false
        show-header=false
        allow-server-selection=false
        schema-description-expanded=true
        info-description-headings-in-navbar=true
        render-style="view"  {# Swagger like layout #}
        layout="row"  {# Request and response side by side #}
        default-schema-tab="schema"
    ></rapi-doc>

and this is my schema object (modified scopes type though)

    DjangoUser:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        username:
          type: string
          description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
            only.
          pattern: ^[\\w.@+-]+$
          maxLength: 150
        full_name:
          type: string
          readOnly: true
        email:
          type: string
          format: email
          title: Email address
          maxLength: 254
      required:
      - full_name
      - id
      - username
    ManagementLock:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        start_date:
          type: string
          format: date-time
        end_date:
          type: string
          format: date-time
          nullable: true
        user:
          $ref: '#/components/schemas/DjangoUser'
        comments:
          type: string
          nullable: true
        status:
          enum:
          - active
          - finished
          - cancelled
          - scheduled
          type: string
          readOnly: true
        type:
          enum:
          - vcenter
          - bsm
          - influxdb
          - artifactory
          type: string
        targets:
          type: array
          items:
            type: string
          readOnly: true
          description: Deprecated.
          deprecated: true
        scopes:
          type: array
          items:
            type: string
          readOnly: true
          description: Available for 'XXX' lock type only.
      required:
      - id
      - scopes
      - start_date
      - status
      - targets
      - type
      - user
      ```

@mrin9
Copy link
Collaborator

mrin9 commented May 25, 2022

Thanks for sharing. I think I have got the issue.
It is a bug when render-style='view'
works as expected when render-style='read' or render-style='focused'

I will work on it to fix it soon

@mrin9 mrin9 closed this as completed in 091551e May 28, 2022
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