Skip to content

Model the local API Explorer fixtures without a key prefix hack #4721

Open

Description

@Mpdreamz

The docs-builder- prefix on API keys in docs/_docset.yml exists only so this repo can preview API pages locally, and it should be modeled explicitly.

What is getting in your way

docs/_docset.yml declares its API fixtures as docs-builder-elasticsearch, docs-builder-kibana and so on. These are copies of product specs for isolated preview. The assembler also loads this checkout, and two docsets that declare the same API key produce a Duplicate API key error in DiscoverApiOwners. The prefix avoids that error, and several places then special-case it:

  • IsolatedApiAliases.IsFixtureKey and IsolatedApiAliases.UrlKey in src/Elastic.ApiExplorer/Infrastructure/IsolatedApiAliases.cs recognize and strip the prefix.
  • OpenApiGenerator.ApiConfigsToRender skips the keys in the assembler and shortens them in isolated builds.
  • AssemblerOpenApiBuildStep.DiscoverApiOwners skips them.

The declared key and the URL key differ in this one repo. An api: elasticsearch toc entry from Mount API pages in the navigation of isolated builds matches the short key, not the declared one, which is easy to get wrong.

What would you like instead

A fixture is a declared concept and not a naming convention. For example, an api: entry could carry a flag such as fixture: true, or the fixtures could move out of the product namespace. Then the assembler can skip them without reading a prefix, and isolated builds can serve them under their normal key.

Whatever shape wins, the key in docset.yml and the key in the URL should be the same string.

Anything else

The history does not state why the prefix exists. The reason above comes from reading the code that uses it. The change was introduced in Restyle API Explorer pages, sidebar, and top bar.

This is accepted as it is for now. RFC: Floating sections in the navigation tree works with the prefix as it is.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions