docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

Non-required yaml spec fields showing as required in generated documentation

Open outofthisworld opened this issue 1 year ago • 0 comments

Describe the bug

My yaml spec doc contains the following non-required headers for a POST endpoint:

      parameters:
        - schema:
            type: string
          in: header
          name: Authorization
          required: false
        - schema:
            type: string
          in: header
          name: X-Api-Key
          required: false
        - schema: {}
          in: header
          name: X-Request-Id
          required: false

After generating my API's yaml spec in a cloned version of the github example project recommended in the docs, the UI shows these headers as 'required'. I have attached an image below.

On a side note and unrelated to this issue, I was wondering if someone could elaborate on how endpoints are grouped in the sidebar of the docs.

I have each endpoint in my api tagged with a tag specific to the resource. E.G /pets endpoints get the tag "pets" (incl del, put,patch) - and the same for other resources. The sidebar nav seems to group everything randomly, rather than the endpoints by their associated tag. Swagger displays them exactly how I would have expected and groups them by this tag. Is there a way I can accomplish a similar thing using this plugin?

Expected behavior

Non-required headers should not be labeled as required.

Current behavior

The opposite of above.

Possible solution

Fix UI.

Steps to reproduce

  1. Clone recommended git project
  2. Generate docs from a spec with non-required headers
  3. Serve project
  4. View output

Screenshots

Screenshot 2024-05-15 at 11 18 07 PM

Context

Just inaccurate.

Your Environment

Node 19, using cloned example repo from main github project page.

outofthisworld avatar May 15 '24 11:05 outofthisworld