PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

Ignore unknown vendor extensions

Open
#891 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem?

My API contains custom vendor extensions so it does certain actions as part of the build. The plugin should ignore or skip any it doesn't know.
(I wasn't sure if this was a bug or enhancemenmt)

For example:

"x-coa-command-group": "nodes",

I have to remove them each time, otherwise I get an error like:

> docusaurus gen-api-docs all

Loading of api failed for "/Users/tatiana/Documents/coalesce-docs/static/api/coalesce-api.json"

[ERROR] TypeError: Cannot create property 'description' on string 'nodes'
    at createItems (/Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:109:45)
    at processOpenapiFile (/Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:511:19)
    at async /Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:464:35
    at async Promise.all (index 0)
    at async processOpenapiFiles (/Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:475:22)
    at async generateApiDocs (/Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/index.js:95:44)
    at async /Users/tatiana/Documents/coalesce-docs/node_modules/docusaurus-plugin-openapi-docs/lib/index.js:439:15
[INFO] Docusaurus version: 3.4.0
Describe the solution you'd like

Ignore the unknown vendor extensions. Don't try to process or do anything with them.

Describe alternatives you've considered

None, I need them for code generation for the company app. I can't take them out.

Additional context

If left in, I get error messages and the reference won't generate.

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 with lib/openapi/openapi.js, especially createItems and processOpenapiFile, using the docusaurus gen-api-docs all reproduction. Verify that x-coa-command-group and other unknown x-* values no longer fail generation while standard OpenAPI fields are still processed. The payload does not name a test file, so locate the relevant coverage before validating the change.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.