Skip to content

Allow more than one x-codeSample #1204

Open
@tjperry07

Description

@tjperry07

Is your feature request related to a problem?

While x-codeSamples does work, you can only have one per language. Otherwise you get a

Docusaurus error: Duplicate values "PowerShell, PowerShell" found in <Tabs>. Every value needs to be unique.

or whatever language you're using.

Describe the solution you'd like

The ability to have multiple x-codeSamples of the same language on an endpoint.

        "x-codeSamples": [
          {
            "lang": "Python",
            "label": "KeyPair Auth",
            "source": {
              "$ref": "./code-samples/rerun/python_requests_keypair.py"
            }
          },
          {
            "lang": "Python",
            "label": "Basic Auth",
            "source": {
              "$ref": "./code-samples/rerun/python_requests_basic.py"
            }
          },
          {
            "lang": "Python",
            "label": "OAuth",
            "source": {
              "$ref": "./code-samples/rerun/python_requests_oauth.py"
            }
          },
          {
            "lang": "PowerShell",
            "label": "KeyPair Auth",
            "source": {
              "$ref": "./code-samples/rerun/powershell_keypair.ps1"
            }
          },
          {
            "lang": "PowerShell",
            "label": "OAuth",
            "source": {
              "$ref": "./code-samples/rerun/powershell_oauth.ps1"
            }
          },
          {
            "lang": "PowerShell",
            "label": "Basic Auth",
            "source": {
              "$ref": "./code-samples/rerun/powershell_basic.ps1"
            }
          }
        ],

Describe alternatives you've considered

I have a workaround already mentioned in #1036. I spun up a clean version without any workarounds to test x-CodeSamples.

Additional context

"docusaurus-plugin-openapi-docs": "^4.5.1",
"docusaurus-theme-openapi-docs": "^4.5.1",
"@docusaurus/preset-classic": "^3.7.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions