Skip to content

Unique summaries per path #4277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lcawl opened this issue Apr 14, 2025 · 3 comments
Open

Unique summaries per path #4277

lcawl opened this issue Apr 14, 2025 · 3 comments

Comments

@lcawl
Copy link
Contributor

lcawl commented Apr 14, 2025

🚀 Feature Proposal

Have a maximum of one specification per unique path.
Alternatively, have a method for specifying a unique operation summary for each unique path so that this information can be used in the OpenAPI document output.

NOTE: This might eventually overlap with a desire for something like x-tagGroups, where we could group similar endpoints and affect the navigation such that tags have a hierarchy. That's not yet supported in our publishing system, however.

Motivation

Currently we can have multiple paths represented in a single specification, for example:

https://github.com./elastic/elasticsearch-specification/blob/main/specification/nodes/stats/NodesStatsRequest.ts

 urls: [
    {
      path: '/_nodes/stats'
      methods: ['GET']
    },
    {
      path: '/_nodes/{node_id}/stats'
      methods: ['GET']
    },
    {
      path: '/_nodes/stats/{metric}'
      methods: ['GET']
    },
    {
      path: '/_nodes/{node_id}/stats/{metric}'
      methods: ['GET']
    },
    {
      path: '/_nodes/stats/{metric}/{index_metric}'
      methods: ['GET']
    },
    {
      path: '/_nodes/{node_id}/stats/{metric}/{index_metric}'
      methods: ['GET']
    }
  ]

Since they're all covered in a single specification, they all share the same operation summary and description in the OpenAPI output, which makes it harder to tell which one to use:

Image

Example

Since we only had a single page in the old docs for content like this (e.g. https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-stats.html) we don't have an example that shows how the description should vary, but the work required to explain those difference is worth the effort IMO.

@DaveCTurner
Copy link

we don't have an example

I encountered this issue too and can provide an example: the get snapshot status API has a summary which mentions the {repository} and {snapshot} parameters which makes no sense in the docs for GET /_snapshot/_status which has neither parameter. With separate summaries for each pattern we can make it much clearer that GET /_snapshot/_status yields only the currently running snapshots, GET /_snapshot/{repository}/_status yields only the currently running snapshots in that repository, and GET /_snapshot/{repository}/{snapshot}/_status looks up the specified snapshots.

@sophiec20
Copy link

Also relevant for several of the ML APIs (not just datafeed preview).

Image
GET /_ml/datafeeds/{datafeed_id}/_preview
POST /_ml/datafeeds/{datafeed_id}/_preview
GET /_ml/datafeeds/_preview
POST /_ml/datafeeds/_preview

With the added complication that is includes {xxx_id} param and supports both POST and GET.

This was represented as a single page in old docs. https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-preview-datafeed.html

@lcawl
Copy link
Contributor Author

lcawl commented Apr 23, 2025

@swallez If we have to continue publishing all variations of the paths from a single specification file and want to have some way of defining unique operation summaries at a minimum, could it perhaps be accomplished in the specifications like this?:

 urls: [
    {
      path: '/_nodes/stats'
      methods: ['GET']
      summary: "Get all stats for all nodes"
    },
    {
      path: '/_nodes/{node_id}/stats'
      methods: ['GET']
      summary: "Get all stats for a node"
    },
    ...

... or whatever text makes it easier for folks to skim and understand the differences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants