Skip to content

Read single-or-array rows as "Rescore or Rescore[]" - #4380

Merged
akira28 merged 2 commits into
mainfrom
api-explorer/single-or-array-wording
Oct 9, 2026
Merged

akira28 merged 2 commits into
mainfrom
api-explorer/single-or-array-wording

Conversation

@akira28

@akira28 akira28 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

API Explorer rows typed X | X[] that list the fields of X, such as rescore, now read "Rescore or Rescore[]" instead of "A single Rescore or an array of them".

Affects: API reference

Prompt summary: The author asked to replace the wording "A single Rescore or an array of them" with "Rescore or Rescore[]".

Why

The line added in #4370 spelled out in prose what the rest of the API Explorer writes as type notation. A nested union's label already reads "Like or Like[]; each Like is one of:", so the two forms of the same idea read differently.

What

Type notation instead of prose

The line now shows the two shapes as code, X and X[], joined by "or" in the same style as option rows. A map reads "map string to HighlightField or [] map string to HighlightField", with the [] in front as type annotations write arrays, since a trailing [] would read as a map of arrays. The Markdown export reads "Rescore or Rescore[]".

Where to look

Example Link
rescore open
A map: collapse.inner_hits.highlight.fields open

Verify

dotnet run --project tests/Elastic.ApiExplorer.Tests
# BuildPropertyList_SingleOrArrayRowListingFields_SaysAnArrayIsAccepted

🤖 Generated with Claude Code

A field such as `rescore` read "A single Rescore or an array of them"
under its description. "Rescore or Rescore[]" says the same in the
notation the rest of the explorer uses, as the "Like or Like[]" label of
a nested union already does. The Markdown export reads the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akira28
akira28 requested a review from a team as a code owner October 9, 2026 10:53
@akira28
akira28 requested a review from theletterf October 9, 2026 10:53

if (property.SingleOrArrayOf is { } single)
WriteNestedLine(markdown, depth, $"A single `{single}` or an array of them");
WriteNestedLine(markdown, depth, $"`{single}` or `{single}[]`");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P2 (Medium)

For map-valued rows, appending [] to the label makes the array option look like a map whose values are arrays, rather than an array of maps.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0937a08. A map's array form now takes the [] in front, "[] map string to HighlightField", the prefix type annotations use for arrays, so it reads as an array of maps. Named types keep "Rescore[]". BuildPropertyList_SingleOrArrayRowListingFields_SaysAnArrayIsAccepted checks both spellings.

"map string to HighlightField[]" read as a map whose values are arrays,
not an array of maps. A map's array form now reads "[] map string to
HighlightField", the prefix type annotations use for arrays. Named types
keep "Rescore[]".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Docs preview (local build)

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

@akira28
akira28 merged commit a4ba22c into main Oct 9, 2026
32 checks passed
@akira28
akira28 deleted the api-explorer/single-or-array-wording branch October 9, 2026 11:10
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