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

Allow `Default` examples in Request section

Open Dr-Electron opened this issue 2 years ago • 0 comments

Describe the bug

Currently our spec contains a Default example. Which breaks the plugin, as the name and value default is already used for the defaultBody.But seeing that in the Response section you call the same thing Example (from schema), I think it makes sense to use the same name in the Request section. What do you think?

Possible solution

I created a small PR to preview how the change should look like: #612.

Steps to reproduce

Create OpenAPI spec which contains an example which is called Default. Example: https://raw.githubusercontent.com/iotaledger/tips/main/tips/TIP-0013/rest-api.yaml

requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddPeerRequest'
            examples:
              default:
                $ref: '#/components/examples/post-peer-request-example'

Screenshots

example

Your Environment

  • Version used: v2.0.0-beta.3
  • Link to your project: https://github.com/iota-wiki/iota-wiki
    • Config: https://github.com/iotaledger/iota-wiki/blob/8df00e0a44a7600b711d1244819726dce14c014d/iota/docusaurus.config.js#L229C23-L229C23

Dr-Electron avatar Aug 14 '23 09:08 Dr-Electron