Repository navigation
Conversation
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4313/ |
f0557e4 to
632b3a4
Compare
632b3a4 to
416c4e5
Compare
There was a problem hiding this comment.
Requesting changes due to a correctness issue in required-field propagation for the new allOf + union variant expansion path (see inline comment).
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
416c4e5 to
9fa12ac
Compare
There was a problem hiding this comment.
Requesting changes for two correctness regressions in the new allOf + union rendering path: shared union-level properties can disappear, and duplicate property names can lose variant-specific constraints.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
An `allOf` that combined a base schema with a `oneOf` or `anyOf` showed only the base properties, so the choice between variants was invisible. Each object variant now renders the shared base properties plus its own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The variant schema built for an `allOf` with a `oneOf` or `anyOf` had no `required` list, so required properties of the base and the variant rendered as optional. It now collects the lists of every member. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A union that declares its own properties lost them from the property row once unions stopped counting as plain objects, and a variant could not redefine a base property of the same name. Unions with direct properties list them again, and the merged variant schema takes the variant's definition when names clash. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
9fa12ac to
35db829
Compare
There was a problem hiding this comment.
Requesting changes for a correctness regression in the new allOf + oneOf/anyOf expansion path: properties/required declared on the union-bearing allOf member are dropped from rendered variants.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
| if (keyword is null || variants is null) | ||
| continue; | ||
|
|
||
| var bases = allOf.Where(m => !ReferenceEquals(m, member)).ToArray(); |
There was a problem hiding this comment.
[HIGH] allOf union-member shared properties are dropped from expanded variants
TrySplitAllOfUnion removes the union member from bases, and ClassifyAllOfUnion later builds each variant from MergeBasesInto(split.Bases, o.Schema). That loses properties/required declared directly on the union member itself.
Concrete failure shape:
pet:
allOf:
- $ref: '#/components/schemas/Base'
- type: object
properties:
kind: { type: string }
required: [kind]
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'With the new split path, kind is not included in either expanded variant (Cat/Dog), and its required badge is lost. Before this change, GetSchemaProperties(allOf) included that member’s direct properties.
Please include the union member’s own non-union constraints (its direct/allOf-derived properties and required set) when synthesizing each variant.
|
Superseded by #4327, which joins all seven PRs of this stack into one. The commits and the resolved review threads carry over. |
An
allOfthat combines a base schema with aoneOforanyOfnow renders its variants in the API reference. Each object variant shows the shared base properties plus its own.Affects: API reference
Prompt summary: Improve how the API Explorer renders
anyOf,oneOfandallOf, starting with the cases that lose information today. This PR covers the first one: unions nested in anallOf.Why
GetSchemaPropertiesmerges only thepropertiesofallOfmembers, so aoneOforanyOfmember contributes nothing. A reader sees the base properties and never learns that the value is one of several shapes.What
Unions inside
allOfSchemaAnalyzernow recognises anallOfwith a union member and classifies the schema as that union. The base members must contribute properties. AnallOfthat only wraps a union$refkeeps its previous rendering.Variants carry the base properties
Each object variant expands to the base properties followed by its own, through the existing variant list. Array and primitive variants are left unchanged. Shared properties repeat in every variant, and the
requiredlists of the base and the variant carry over, so required properties keep their badge. When a variant redefines a base property of the same name, the variant's definition wins.Property rows
A union stops being listed as a plain nested object only when its properties come from an
allOf. A union that declarespropertiesitself keeps listing them, andApiPropertyTreeBuilderhands the rest to the variant list.Verify
Out of scope:
$reftargets that are themselvesallOf+oneOf, listing shared properties once instead of per variant, and the Markdown export output. Later PRs in this stack can cover them.Stack: 1 of 1 so far, the bottom of the stack on
main. Further fixes will be added on top.🤖 Generated with Claude Code