Skip to content

Distinct Pages By Discriminator #1113

Open
@SJrX

Description

@SJrX

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.

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