PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

defualt values dont show on enums when using a ref

Open
#977 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Describe the bug

Will display the default value when the docs are generated:

primary_request_method:
          type: string
          enum:
            - GET
            - POST
          example: GET
          description: Primary request method of the External LAML Handler.
          default: GET

Will not display a default value

        primary_request_method:
          allOf:
            - $ref: '#/components/schemas/UrlMethodType'
          example: GET
          description: Primary request method of the External LAML Handler.
          default: POST

UrlMethodType Enum looks like:

    UrlMethodType:
      type: string
      enum:
        - GET
        - POST

Expected behavior

For Default value to always be shown, regardless if its using a ref or not.

Current behavior

No default is exposed when spec is written like the second example above.

Possible solution

Inline enums to allow default value to be shown.

Steps to reproduce

Look at examples above.

Context

Useful to allow this to work on refs so I can reuse the same type in multiple places, rather then constantly inlining my enum.

  • Version used: 3.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the inline enum and the $ref-based enum examples from the report, then trace the OpenAPI schema rendering and reference-resolution entry points. Done means the generated documentation exposes the default value for the referenced enum as well as for the inline enum.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.