Skip to content

Default boolean property value not rendered #1779

Closed

Description

@cmeeren

These properties:

image

Render as:

image

As you can see, the default value is missing.

If I instead use strings for the default value, it works:

image

image

Activity

  1. zalesky commented on Oct 22, 2021

    @zalesky
    Contributor

    @cmeeren Thanks for reporting the issue. I can't reproduce it so could you be so kind to provide more details?

    category:
      type: object
      properties:
        bool1:
          type: boolean
          default: true
        bool2:
          type: boolean
          default: false
      required:
        - bool1
        - bool2

    Screenshot 2021-10-22 at 18 06 24

  2. cmeeren commented on Oct 26, 2021

    @cmeeren
    Author

    Forgot to mention that I was rendering a schema using SchemaDefinition (in a tag description if that matters), not a request body. Can you reproduce then?

  3. zalesky commented on Oct 27, 2021

    @zalesky
    Contributor

    @cmeeren could you provide a definition, please?

  4. cmeeren commented on Oct 27, 2021

    @cmeeren
    Author
    test:
      properties:
        test:
          type: boolean
          default: false

    image

    I am using the redoc version fetched by https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js

  5. zalesky commented on Oct 27, 2021

    @zalesky
    Contributor

    @cmeeren sorry, it's not helpful, I still don't know where you put this in the definition. Can you provide a full definition or be more clear where is placed this part?

    test:
      properties:
        test:
          type: boolean
          default: false

    I see "not a request body" and I've never seen anything like "in a tag description" before

  6. cmeeren commented on Oct 27, 2021

    @cmeeren
    Author
    openapi: 3.0.2
    info: {}
    
    tags:
      - name: foo
        description: |
          <SchemaDefinition schemaRef="#/components/schemas/test" />
    
    components:
    
      schemas:
    
        test:
          properties:
            test:
              type: boolean
              default: false
  7. zalesky commented on Oct 27, 2021

    @zalesky
    Contributor

    tried next steps without success:

    • create file test.html
    <!DOCTYPE html>
    <html>
    <body>
    <redoc spec-url=http://localhost:5000/openapi.yaml></redoc>
    <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"></script>
    </body>
    </html>
    • create file openapi.yaml
    openapi: 3.0.2
    info: {}
    tags:
      - name: foo
        description: |
          <SchemaDefinition schemaRef="#/components/schemas/test" />
    components:
      schemas:
        test:
          required:
            -test
          properties:
            test:
              type: boolean
              default: false

    Screenshot 2021-10-27 at 14 36 47

  8. cmeeren commented on Oct 27, 2021

    @cmeeren
    Author

    I see now that it only happens when using the enumSkipQuotes option. Sorry for not catching that sooner. Are you able to reproduce then?

    <div id="redoc-container"></div>
    <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"></script>
    <script>Redoc.init("spec.yaml", { enumSkipQuotes: true })</script>
  9. added a commit that references this issue on Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions