Skip to content

Label anyOf options "Any of:" in API reference - #4319

Closed
akira28 wants to merge 2 commits into
api-explorer-unions/discriminator-valuesfrom
api-explorer-unions/any-of-label
Closed

akira28 wants to merge 2 commits into
api-explorer-unions/discriminator-valuesfrom
api-explorer-unions/any-of-label

Conversation

@akira28

@akira28 akira28 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Rows for anyOf unions in the API reference now read "Any of:" instead of "One of:". oneOf unions keep "One of:".

Affects: API reference

Prompt summary: Improve how the API Explorer renders anyOf, oneOf and allOf, one fix per stacked PR. This PR covers the fourth: telling anyOf apart from oneOf on property and parameter rows.

Why

A value of an anyOf type can match several options at once. A value of a oneOf type matches exactly one. Every row said "One of:", so a reader could not tell a choice from a combination.

What

Union keyword on the type

TypeInfo records whether a union came from oneOf or anyOf. Both the inline path and the $ref path set it. When a schema has both keywords, oneOf wins, as it already did for the options.

Row label

Property rows, path parameters and query parameters take their label from that keyword through SchemaHelpers.UnionLabel. The Markdown export uses the same label, so both views agree.

Verify

dotnet test tests/Elastic.ApiExplorer.Tests/
# BuildPropertyList_AnyOfUnion_LabelsTheRowAnyOfAndOneOfUnionsOneOf

Out of scope: the expanded variant list, which separates variants with "or" for both keywords, and the "Union Types" headings on schema pages, which already name the keyword. I haven't viewed the label on a rendered page.

Stack: 4 of 4, on top of #4317, #4314 and #4313.

🤖 Generated with Claude Code

@akira28
akira28 added this pull request to stack #4315 October 6, 2026 08:37
@akira28 akira28 changed the title Label anyOf options "Any of:" in the API Explorer Label anyOf options "Any of:" in API reference Oct 6, 2026
@akira28
akira28 force-pushed the api-explorer-unions/any-of-label branch from b609ebe to 6ac4941 Compare October 6, 2026 11:31
@akira28
akira28 force-pushed the api-explorer-unions/discriminator-values branch from 6d8e686 to 0ca2cc9 Compare October 6, 2026 11:31
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4319/

@akira28
akira28 marked this pull request as ready for review October 6, 2026 11:42
@akira28
akira28 requested a review from a team as a code owner October 6, 2026 11:42
@akira28
akira28 requested a review from Mpdreamz October 6, 2026 11:42
Comment thread tests/Elastic.ApiExplorer.Tests/ApiPropertyTreeBuilderTests.cs Outdated
@akira28
akira28 force-pushed the api-explorer-unions/any-of-label branch from 6ac4941 to a4c0c47 Compare October 6, 2026 13:13
@akira28
akira28 force-pushed the api-explorer-unions/discriminator-values branch from 0ca2cc9 to 859455f Compare October 6, 2026 13:14
akira28 and others added 2 commits October 6, 2026 15:34
Property and parameter rows said "One of:" for every union, although an `anyOf` value can match several options at once. The union now carries its schema keyword, and rows read "Any of:" for `anyOf` and "One of:" for `oneOf`, in HTML and Markdown.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test printed a debug dump of every property row that its assertions already cover.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@akira28
akira28 force-pushed the api-explorer-unions/discriminator-values branch from 859455f to 4e59fdd Compare October 6, 2026 13:35
@akira28
akira28 force-pushed the api-explorer-unions/any-of-label branch from a4c0c47 to a7fab59 Compare October 6, 2026 13:35
@akira28
akira28 removed this pull request from stack #4315 October 6, 2026 13:51
@akira28

akira28 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #4327, which joins all seven PRs of this stack into one. The commits and the resolved review threads carry over.

@akira28 akira28 closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant