PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

Distinct Pages By Discriminator

Open
#1,113 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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?

We have a RESTful API and in some cases an endpoint has a few different mutually exclusive representations, maybe an example might be from the Showcase, the "Debug Host" command: https://docs.defined.net/api/host-command/

Other than these endpoints using the same URL they are essentially otherwise disjoint conceptually. The way the UX is laid out know, you just have a bunch of oneOfs in the response and request, this makes things compressed when the endpoint has more differences than similarities.

Describe the solution you'd like

So OpenAPI prevents you from having multiple definitions for the same route/method. But I guess would be nice is a way via OpenAPI extensions and configuration, have distinct pages be rendered based on the discriminator value, it would be all extension based, and then instead of renedring the pages as one page with just different one ofs, we could make it easier for users to understand and digest the endpoint.

For instance in the Debug Host, above, lots of the details about each command you can run, just have to be buried in the schemas of the objects, and the high level more visible text has to be general, so if you are trying to Create a Tunnel, the only high level thing it can say is

Successful operation. 'StreamLogs' will return a newline-delimited JSON stream, the rest return standard JSON.

What' I'm proposing would allow for something like:

- Hosts
- Create host
- List host
- ....
- Stream Logs
- Create Tunnel
- Print Tunnel
- Print Cert
- Query Lighhouse

Or maybe

- Hosts
- Create host
- List host
- ....
- Debug
  - Stream Logs
  - Create Tunnel
  - Print Tunnel
  - Print Cert
  - Query Lighhouse
Describe alternatives you've considered

I tried to see if there was some way to do this already, but after 10 minutes didn't see anything.

Additional context

Primarily for us we have migrated from hand rolled API documentation to OpenAPI spec based stuff, but we have some APIs where admittedly the way things are compressed makes it very difficult for users to understand, and in some cases some feedback has been that the old docs were better in a few cases.

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 reviewing how the plugin currently renders discriminator and oneOf schemas, then compare that behavior with the Debug Host example in the issue. Define the extension or configuration shape and validate that discriminator variants can appear as distinct, understandable pages without breaking existing OpenAPI documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, react, typescript
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.