Skip to content
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

[OpenAPI] Automatically generate the list of tags #2984

Open
lcawl opened this issue Oct 4, 2024 · 0 comments
Open

[OpenAPI] Automatically generate the list of tags #2984

lcawl opened this issue Oct 4, 2024 · 0 comments

Comments

@lcawl
Copy link
Contributor

lcawl commented Oct 4, 2024

Relates to #2310

🚀 Feature Proposal

The OpenAPI documents should contain root-level list of all the tags that are used in the document.
The kbn-openapi-bundler generates this list of tags sorted alphabetically so it would be nice to have a similar feature for Elasticsearch.

There is a complexity around the x-displayName associated with the tag, which should affect the sort order but is not currently known in the specification. So this might require us to have that mapping between tag name and displayName stored somewhere in the spec too.

Motivation

Per https://spec.openapis.org/oas/v3.0.3#fixed-fields, it's "A list of tags used by the specification with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools...".

Per https://docs.bump.sh/help/customization-options/operations-navigation/#group-operations-by-tag, since we've chosen to group our operations by tag, "Bump.sh will use the tags from your API definition to group, name and sort operations".

Example

Currently we're addressing this need by using an overlay: https://github.com/elastic/elasticsearch-specification/blob/main/docs/overlays/elasticsearch-shared-overlays.yaml

For example:

  - target: '$'
    description: Add document-level tags sorted by display name
    update:
      tags:
      # A
        - name: autoscaling
          x-displayName: Autoscaling
      # B
        - name: analytics
          x-displayName: Behavioral analytics
      # C 
        - name: cat
          x-displayName: Compact and aligned text (CAT)
          description: >
            The compact and aligned text (CAT) APIs aim are intended only for human consumption using the Kibana console or command line.
            They are not intended for use by applications...

We've also added a linting rule to indicate when an operation-level tag is missing from the document-level list, however it would be nice to not have to maintain that list manually in the overlay.

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

1 participant