Skip to content

feat!: unify schema composition, folding and routing - #2354

Draft
OmarAlJarrah wants to merge 1106 commits into
mainfrom
fix/openapi-schema-composition
Draft

OmarAlJarrah wants to merge 1106 commits into
mainfrom
fix/openapi-schema-composition

Conversation

@OmarAlJarrah

@OmarAlJarrah OmarAlJarrah commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

This draft makes one OpenAPI schema conjunction lower to one result wherever its keywords are written. It covers schema composition (allOf, oneOf, anyOf and the keywords beside them), the member fold, value admission, nullability and discriminator routing, and it lands in the steps below.

Progress

The composition and alias-chain readers are built before value admission, which reads the alias-chain index and ir.ComposedOf they add.

Five issues these steps touch stay open. #2072 is decided, one report per keyword kept, as the flat spelling reports it, and #2118's and #2119's reproductions lower as they ask, but the schema cases still record spelling findings under each one's reason (split-degraded-reports, entry-competing-value-set and entry-value-set). #2371 is settled for a union whose branches are value sets; a union of typed branches beside a value set, as its reproduction writes, is still kept degraded_lowering, now with its dead branch named. #1993's hierarchy at 3,000 levels now compiles where main refuses it with openapi/budget-exceeded, but the whole compile still costs what main's does and grows about 2.8 times per doubling of the depth.

Breaking

At this head:

  • ir.IRVersion is 0.74.0, with two members. Discriminator.DecodeOnlyRoutes (decodeOnlyRoutes, omitted when empty) maps a wire value to the type a payload carrying it routes to, for each route the source gives that Mapping leaves out. A decoder reads it after Mapping, or after a union's variant type names where its Mapping is empty, and an encoder never writes it. irverify reports a tag one discriminator routes by two spellings (ir/discriminator-route-repeated). Enum.Constraints (constraints, omitted when nil) holds the bounds an enum's schema writes of the kinds of value its ValueType holds, closed or open, and ir/bound-of-another-kind holds an enum to them. The OpenAPI compiler fills Enum.Constraints; no compiler writes DecodeOnlyRoutes yet. A consumer pinned to 0.73.0 refuses a document carrying either member.
  • An expanded dynamic reference at a position no carrier holds lowers to the type of the position it names, as a $ref there does, where an alias holding only its Base stood. This holds where it is written alone, or beside only keywords no node holds ($anchor, $comment, $defs, $dynamicAnchor, a nullable in a 3.1 or 3.2 document, which stays on the reference, definitions under draft-04, draft-06 or draft-07, $recursiveAnchor under 2019-09), at items, prefixItems, additionalProperties, a oneOf branch or a body.
  • A $ref, or a $dynamicRef naming a JSON pointer, whose one other keyword is definitions under draft-04, draft-06 or draft-07 or $recursiveAnchor under 2019-09 lowers to its target the same way, at those positions and at an allOf entry. A component written so over an object changes kind at its own ID: it was a Scalar with its target as Base, and is now the Model whose Base is its target, as a component writing an annotation beside its $ref is.
  • No position hoists a node that would hold nothing: neither an alias nor, over an object, the Model composing it. At items, prefixItems, additionalProperties, a oneOf branch or a body, that covers a $ref or an expanded dynamic reference beside only annotations, unknown keywords, a dependentRequired, or extensions inside a discriminator whose values no JSON value holds (such as example: .nan), and, over an object or beside a dynamic reference, an annotation saying nothing (description: '', deprecated: false). At items, prefixItems, additionalProperties, a oneOf branch or a request or response body, it covers a schema lowered to a shared primitive, itself or through the inline allOf entry it refines to, beside keywords it does not read whose values no JSON value holds (required, default or minimum on a string, or an unknown keyword). What the node's keepers reported stands, once, at the position, and a use admitting null keeps its Model. On the golden spec this drops one Model holding only its Base, at a 4XX response body.
  • The home of an expanded dynamic reference to an object, at those positions or a component, is the Model composing that object, as a $ref's is, where it was a Scalar with that Base. So a component such as U: {$dynamicRef: '#t', description: u}, where #t names an object, changes kind at its own ID.
  • A schema writing a oneOf or anyOf beside structural keywords holds a bound an allOf entry writes, such as maxItems, in its node's Constraints alone, as its plain twin does. It no longer also keeps it under openapi:maxItems with a finding.
  • The member fold's reports change, and no IR node does. Each sits at, and names, a place writing what it speaks of, never the allOf entry bringing the declaration, and names no node in Provenance.Node. Each lists every member it decided as decided, and one about two declarations names as kept the first written of those agreeing with the one kept, so no order of the entries decides it. Reports alike but for those members are said once, after pruning, naming the field they compose, and one left deciding none goes, unless it is an error. irverify reports a decided entry naming no type or property the document holds (ir/related-decided-unresolved).
  • What a node keeps settles once. A value written alike by several writers is kept once and reported once, at the outermost writer, where a carrier, a 3.0 exclusive flag with no bound and two entries writing one default each kept or reported it twice. Values written otherwise keep the outermost writer's under the plain key and each other writer's under its entry key, so two writers giving an unknown key or a passed-over enum different values no longer lose one, nor draw openapi/internal-invariant. An entry kept whole takes the reason its keyword takes alone, validation_only or no_ir_home where it took out_of_scope or degraded_lowering, and one report naming every keyword it holds. A boolean exclusiveMinimum or exclusiveMaximum is never kept under a plain key beside another writer's bound. A kept $dynamicRef moves from openapi:$ref to openapi:$dynamicRef, an entry's value set kept apart moves from its entry key to openapi:enum or openapi:const where no other writer writes that key, and a vendor extension whose value no JSON holds is left out of an entry or keyword kept whole, with its warning, where the whole construct was refused.
  • A keyword at the value its dialect equates with its absence is read as left out wherever it is written: a lone {type: string, minLength: 0} holds no Constraints.MinLength, a false uniqueItems leaves Constraints nil, a false readOnly or writeOnly on a type declaration is no longer kept, pattern: "" is kept nowhere, and a position writing only such a keyword beside a $ref, a 3.0 nullable: false among them, hoists no node. A null on a key no dialect defines is a value.
  • A conjunct restating the $ref beside it says nothing. {allOf: [{$ref: Obj}], type: object} lowers to the reference to Obj, where an anonymous Model whose Base was Obj stood, and a carrier there reads Obj's description and deprecation. An entry's keyword the referent writes alike, items among them, is neither kept nor reported, and an entry's properties restating some of the referent's alike, beside no union and no other writer of properties, no longer fold as members of the composition's own.
  • An allOf lowers to a Model only where the kinds it reads are an object alone, so these change node kind at their IDs. A read cut short at a bound, a loop of references, a $ref naming nothing and a value no reading converts give what the other conjuncts say, a Scalar, List, Union or Enum where a Model stood; an allOf nested past the flattening depth is the top type keeping it whole; value sets sharing no member are the closed Enum with no member of their value type, a const beside an enum on one schema among them, where they were a Literal, the top type or a composed Model; and conjuncts whose kinds share none, or value sets that type no Enum, are a closed Model with no member keeping each conjunct verbatim. Conjuncts whose types share only null are the null type, where they composed an open Model. An allOf entry whose $ref names nothing is split like any entry writing a $ref beside other keys, so what it writes beside the reference reaches the position. A schema whose allOf names itself beside properties and an untyped union takes itself as Base, marked by the kind-inference policy, where it kept the $ref. A type word no dialect defines reads in a conjunction as it lowers alone, as a string. In a 3.1 or 3.2 document under the default nullable-inference policy, conjuncts sharing only the null a nullable: true gives are no longer disjoint. Two $ref entries writing one reference text against two bases are kept apart, and the election between them no longer follows their order.
  • A warning that no instance satisfies a schema, a branch or a member moves from openapi/degraded-construct to the new openapi/unsatisfiable-schema, at the same place and in the same words, so a --triage rule naming the old code no longer matches it. Each bottom draws its own, an allOf beside an inline false entry included, and an entry declaring a type other than object beside it is reported by an info, where it drew a warning. A node's findings come in the order its claims settle: the readers', the build's, annotations, folds, use bindings, refinement keeps.
  • An enum: [] beside a const, another enum or a $ref stating a type or a set is the closed empty Enum its flat twin gives, typed as that twin is, where it dropped the const, kept both sets under openapi/unsatisfiable-schema, or was untyped beside a $ref. Beside a const or an enum the other set is kept verbatim under its writer's key; beside a $ref nothing is kept, as the target states its own; and the openapi/empty-enum warning is the one report. A conjunct admitting null alone, beside others admitting null too, gives the closed empty Enum {type: 'null'} gives, no other conjunct narrowing its type. An entry, or the keywords beside the allOf, restating a subset of the $ref's target's properties alike says nothing, as a full restatement does. A report naming the node a kept keyword settled on says scalar where it said primitive.
  • A keyword on another conjunct reaches the node as written flat. A format, the content vocabulary, items, prefixItems and an object bound beside a type list type the node instead of being kept, a type list naming object on an entry is merged rather than kept, and a bound an inline primitive principal takes none of hoists the position's node to hold it, as written flat. Entries disagreeing on one keyword fold the keywords they agree on, bounds and notes alike. The writers of a bound on a number as text meet: the node keeps the met writing and no entry for it, and two steps meeting in a multiple neither writes are kept as that multiple; beside a principal kept whole, each replaced step is kept as written.
  • A format beside a $ref to a scalar reads as its flat twin over the target's type. One selecting no primitive of its own, or the content vocabulary over a string or bytes, makes the position a Scalar whose Base is the reference, carrying the Encoding, at a carrier too; one selecting a narrower primitive roots the position at it, keeping openapi:$ref with one info, so what the target bounds is reached through that kept $ref alone; one the target already is says nothing. Beside a $ref to an Enum, a format selecting no primitive of its own makes the same restricting Scalar, no member copied, and a recognized format (uuid, int32, date-time) is kept verbatim under openapi:format (degraded_lowering), as its flat twin keeps it on the enum. A type list naming null, {type: [string, 'null']}, reads a format by its other kind as its 3.0 twin does, and a target spelt through an allOf holding no $ref is read as its flat twin.
  • A schema writing only identifier and meta keywords ($comment, $id, the anchors, $defs and the like) in items or additionalProperties lowers as {} does, to the top type keeping the applicator, where it inferred a List or a MapT. A closed chain of allOfs each holding one $ref and nothing else saying something is an openapi/cyclic-ref error, a new one in a valid document, its members lowering as a bare $ref loop's do. A link is read on its flattened conjunction, so a nested one-entry allOf, a true entry or a notes-only entry beside it closes the loop too, and a link's $refs on the loop, repeated or not, keep nothing; an entry writing a kind or a member beside its $ref is no link, so its position lowers to its composition, and a loop through a link that writes a kind is read to its greatest fixpoint, its member writing the kind standing as that kind. A number-as-text bound beside a type list is kept once, on the text variant. A lone $dynamicRef entry, also through nested one-entry allOfs, expands in place, and a $ref naming an entry reads it alone, so it may draw openapi/unsatisfiable-schema. A 3.0 array is reported missing items once per conjunction, at the position, where it was reported at the entry the allOf lowered from.
  • One reading of the conjunction decides a union wherever it is written. Beside a body that is no object (a scalar, an array, a type list holding no object, or null alone), a branch sharing no kind with the body is dead: dropped from the variants and named in one openapi/unsatisfiable-schema warning at the union keyword, the union kept once, degraded_lowering where it holds a dead branch and validation_only otherwise. Live branches declaring shape (a $ref, a format) are a Union conjoined with the body's kind; otherwise the body's node keeps the union in every spelling, so {allOf: [{type: string}], oneOf: [{type: string}]} and its entry spelling are the Scalar keeping the oneOf, where they were a Union. Two unions are read together, each unelected union naming its own dead branches, the passed-over one kept degraded_lowering, and where only null survives the position is the closed empty Enum behind a nullable reference. A discriminator stands with its union, and a union beside notes stands alone, wherever written.
  • A body beside a union of an object and another kind distributes by kind: object keywords compose into object branches, a scalar branch's variant is a Scalar holding its kind's bounds, and properties on an entry beside a type list are its object variant's. A body naming no kind beside branches of no object splits the same way, keeping its object keywords. What a distribution keeps over its variants is kept once, on the Union, and a variant distributed from an entry's union is keyed <position>/allOf/-/<k>/…. A branch writing only $schema, $vocabulary or an $id with no relative reference beneath it declares no shape.
  • An additionalProperties closure or typed catch-all, or a patternProperties, over members its own object does not declare still types the model, and is now kept verbatim (degraded_lowering) with an info at the keyword, or an openapi/unsatisfiable-schema warning where it refuses a member another conjunct requires; a branch requiring such a member is dead, and a model the composition brings closed by its own closure, refusing a member another conjunct requires, draws that warning at the position.
  • Inline value sets meet as the flat enum of their shared members, an Enum of one kind or a Union of literals of several, every set kept verbatim. A union whose branches are value sets alone is one set conjunct: where every member of the set beside it satisfies it, it says nothing and is neither kept nor reported; where some do, the position is the Enum of those, each branch holding none named dead.
  • A type naming null alone is a body, and a conjunction admitting null alone is the null type. Under the nullable-inference policy a null branch, or a nullable: true, beside a body keeping null out where no branch lives makes the position null alone behind an inferred nullable reference; with the policy off the branch is dead. An entry's nullable: true beside its type folds under either policy and is no longer kept. A branch conjoined with a scalar body keeps its description, examples and extensions on its node, where they were dropped with no report.
  • The schema cases' recorded reasons for openapi: a oneOf beside an allOf whose entry writes an anyOf lowers apart from the two on one schema #2110, openapi: an additionalProperties closure is typed over members its own object does not declare #2047, openapi: decide whether a 3.0 array's missing items is judged per allOf entry or per conjunction #2048, openapi: an allOf entry's keyword is read for the position only where a list names it, and any other is kept #2210 and openapi: a keyword kept verbatim beside a union on an allOf entry is copied onto every variant, where beside the allOf it is kept once on the union #2054 are removed, as no recorded finding stands under them.
  • A dead branch's warning names the kinds the body admits, where beside a type list it said the body admits objects alone. An entry's type beside a union is read as written flat and no longer kept, and its format is kept where it was dropped; the schema cases' reason for openapi: decide whether a union beside a scalar body is the union or the scalar keeping it #2108 is removed. Entries whose discriminators disagree route nothing. A null-only outcome is the closed empty Enum of no kind in every spelling, its dead branches named, where a type list typed it. A oneOf refuses the null two or more of its live branches admit, so such a reference admits no null, or admits it only as the nullable-inference policy infers.
  • An Enum holds the bounds its schema writes of the kind it lists in Enum.Constraints, closed or open, where each was kept verbatim with an info, and an entry's maxLength on a string Enum joins them; the Union of literals a mixed enum lowers to fills Union.Constraints. pass.ConstUnions folds a bounded union of string consts into an Enum holding the bounds. pass.Validate judges a model by the count bounds of every model it composes, so a default or bounds a base's count rules out draw pass/default-outside-type or pass/bounds-admit-no-value.
  • Beside a contentEncoding, on the same conjunct or another, a Scalar's Base is string where it named a format's primitive, and its Encoding carries no WireType; every format kept there is reported as openapi/unhomed-construct. Content beside a $ref to a scalar read from the text, or to a target spelt as an allOf, lowers as its flat twin, a Scalar over string carrying the Encoding with the $ref kept.
  • The properties and nodes beneath a type list's variant take the IDs and pointers where the source writes them, and are read in that schema's own dialect; each variant's own ID stays. A type a union of literals, or an undecided node, already restates is no longer kept under openapi:type.
  • An unevaluated keyword is typed only where every evaluator it reaches is one the IR types: unevaluatedItems: false beside a prefixItems is a Tuple with no Rest, alone a List of the false schema's node, and unevaluatedProperties: false beside if, dependentSchemas or an overlapping distributed oneOf is kept verbatim where the model was closed after composition.
  • A count past what a 64-bit integer holds draws one report, a refused one at its keyword, and an unresolved $ref past the merge bound one per pointer.
  • Every alias walk reads a chain of any length, so a fact reached through more than 64 aliases (a bound, a type the fold judges, a multipart body, an HTTP date) is read as through fewer. Two models composing each other settle a member to one type, and a composition cycle folds its declarations at once, up to 64 flat and past that as a staged chain keeping every loser. A copy of a schema in another document restates it where both read alike.
  • Null is read once per schema, in dependency order: a chain of allOf references to null admits null at every link in every declaration order, and an expanded $dynamicRef reads its target's null. A union none of whose branches admits null takes the null out of a type list beside it, so {type: [string, 'null'], oneOf: [{type: string}]} is no longer nullable. The nullable-inference policy widens a reference only through a null a value keyword or nullable: true beside it states, no longer through a union's null branch, and widens a conjunction holding no reference, marked inferred. A nullable: true the conjunction keeps null out of draws the new info openapi/unwidened-nullable, and a 3.0 nullable: false, or a nullable: true that widens nothing, beside an allOf of one $ref leaves the position the reference.
  • Every Scalar's Base.Nullable is what its own schema admits, a restriction's and an alias's included, marked inferred where only the policy admits the null; a use's own bit still decides its null. A type of null alone decides over its enum: listing null it is the null type, a union branch so written the union's null, and the members it excludes are kept under openapi:enum. A repeated null in an enum is reported as admitted once. A member one entry declares as a nullable email string and another as a plain string is the email string.

Between 7d7208585 and e912491c8, the golden spec's IR loses one node, the Model at /paths/~1zones~1{zone_id}~1dns_records~1batch/post/responses/4XX/content/application~1json/schema, whose response now names its referent, and otherwise differs only in its version stamp and its findings. In testdata/, the three aliases that stood at an expanded dynamic reference go, and keywords-at-every-outcome.yaml's component Dyn, an expanded $dynamicRef to an object, changes from Scalar to Model.

Between e912491c8 and 721310442, the golden spec (cloudflare/api-schemas @904c5434) loses 55 anonymous Models, each holding a Base and nothing else: 41 properties and 14 request or response bodies now name the referent, and 16 of those properties read its description, one its deprecation too. The two compatibility_flags properties stop keeping an items restating workers_compatibility_flag, and zero-trust-gateway_api-response-common-failure's errors and messages, each type: object beside a $ref to an array, become the closed bottom, keeping their type. 37 types change in all. 14 warnings move to openapi/unsatisfiable-schema at their places and in their words, 5 infos go (the two items reports and three at the bottom), 9 member-fold infos name the referent where they named a removed Model, and of the findings both draw, two reorder at their nodes. Nothing else in the IR moves, and irVersion stays 0.74.0. In testdata/, 17 goldens move.

Between 721310442 and acf451298, the golden spec's three schema_id sites (api-shield_public_schema and api-shield_schema_hosts's properties and the parameter api-shield_schema_id_path) become uuid, keeping openapi:$ref to api-shield_uuid-2 where they named it and kept openapi:format, and their three infos move from the entry writing the format to the one writing the $ref. The minLength: 36 api-shield_uuid-2 writes is now reached only through that kept $ref, as a beaten reference's target is. Nothing else moves. Between acf451298 and 993ca016d, nothing moves. Between 993ca016d and c0ff23bab, tls-certificates-and-hostnames_custom-hostname keeps its Base and no longer redeclares the three properties it restates, its required list now a Requires, and 12 infos say scalar where they said primitive. Nothing else moves. Between c0ff23bab and 5ff6dfe4a, nothing moves, and through 9f36c9655 to 5c7bda09a nothing moves either: 5c7bda09a's types, sections and finding sequence equal c0ff23bab's. Between 5c7bda09a and e7b870541, 35 composed variants distributed from an entry's union take the …/allOf/-/<k>/… key, and the 14 Unions naming them follow, dlp_EntryUpdate's discriminator mapping among them; two of the variants, magic_app_config_add_single_request's, no longer keep the passed-over anyOf, which the Union keeps once. The nine dead-kind sites, one flat value among the posture-api schemas and eight needle.value properties, each draw one openapi/unsatisfiable-schema at the union keyword, and the eight needle.value properties now name a Scalar of their own keeping the union, with an info at the entry writing it. mconn_connector_interrupts_result and the patches and puts items of email-security/settings/url_ignore_patterns/batch each draw one openapi/unsatisfiable-schema for a composed model closed against a member another conjunct requires, and the two cloudforce-one events aggregations items type their catch-all as a nullable string, keeping openapi:additionalProperties with an openapi/unsatisfiable-schema warning, as it refuses the count another conjunct requires, where they kept the whole entry with an info. api-shield_operation and zaraz_zaraz-config-history-response's result catch-all no longer keep an unhomed nullable, nor draw its info. 14 warnings and 8 infos are new and 4 infos go; nothing else moves.

Between e7b870541 and 1c1b4f88b, firewall_components-schemas-mode's maxLength: 12 moves from Unmodeled into its Enum.Constraints, with its info gone, and nine errors response properties, each {type: array, items: {$ref: …}, enum: [[]]}, no longer keep openapi:type, their info naming items alone. Nothing else moves. Between 1c1b4f88b and 9707c9c84, nothing moves. Between 9707c9c84 and afda9a7e2, pages_env_vars and pages_deployment_config_values_request's env_vars mark their nullable catch-all as inferred by the nullable-inference policy, each with an openapi/inferred-nullable info. Between afda9a7e2 and 2a728b2cf, the IR is byte-identical.

Between 2a728b2cf and 6994c782b, logpush_logpull_options and dnssec_dnskey_signing_key's privkey, the golden spec's two nullable restrictions, take a Base admitting null; 29 references gain the nullable-inference mark, no bit changing; 8 openapi/inferred-nullable infos are added; and api-shield_operation's entry and zaraz_zaraz-config-history-response's result catch-all each draw one openapi/unwidened-nullable. Nothing else moves.

Still to land: invalid discriminator errors unified. This section gains the closing list, the golden differential, the limits and the carried questions as that work lands.

Test plan

Related: #2211, #2209, #1985, #2114, #1845, #1843, #2282

Closes #2324, closes #2084, closes #2086, closes #2133, closes #2073, closes #2067, closes #2113, closes #2213, closes #2125, closes #2057, closes #2064, closes #2065, closes #2070, closes #2091, closes #2092, closes #2100, closes #2122, closes #2126, closes #2127, closes #2128, closes #2066, closes #2210, closes #2107, closes #2039, closes #2062, closes #2116, closes #2117, closes #2048, closes #2049, closes #2082, closes #2056, closes #2058, closes #2042, closes #2083, closes #2101, closes #2104, closes #2105, closes #2106, closes #2110, closes #2111, closes #2112, closes #2115, closes #2054, closes #2047, closes #2046, closes #1859, closes #2108, closes #2089, closes #1908, closes #1895, closes #2004, closes #2043, closes #1888, closes #2103, closes #1883, closes #1904, closes #1570, closes #1950, closes #1994, closes #1995, closes #2121, closes #2120, closes #2109, closes #2090, closes #1906, closes #1903, closes #1967.

@OmarAlJarrah OmarAlJarrah changed the title feat(openapi)!: unify schema composition, folding and routing feat!: unify schema composition, folding and routing Nov 29, 2026
This was referenced Nov 29, 2026
Cut what the $ref chain readers' and the value-set judges' comments
restated of their code or told a second time, name
readMembersFilteredByRest's conjunction by its schema rather than a
parameter it no longer has, and rewrap two lines past the width. No code
token changes.
toldWhereWritten and appendFallbackChainRun returned the walk's
no-answer both inside the loop and after it, and the walk now ends on
a hop landing on nothing before the loop can run out, which left the
return after it unreached. Each breaks to that one return instead. A
row holds that a $ref to a schema admitting a value is no schema
telling where it is written that it admits none.
appendFallbackChainRun read the place of every schema a run of $refs
passes, though it keeps only those writing more than their $ref and
the run's end. It now reads the place of those alone. A 4,000-alias
chain each alias of which is used retires about 14.0 billion
instructions rather than 15.4 at GOMAXPROCS=1.
The told-where-written and typed-branches tests' doc comments grew
past 100 words with their new rows; each now names the rows by kind.
The format construct was said of the string target alone, so no case
wrote int32 or int64, and an integer format on an allOf entry was held
to its flat twin only by an e2e table. The construct is now said of the
integer target too, writing int32 and int64 there, so the core cases
hold that spelling as they hold a string format's: an integer format
an entry writes and the position does not read reddens the spelling and
presence oracles.
Each test below fails on its defect planted narrowly, and so does a test
that stays:

- pass: a variant refusing its tag (caught by the catch-all closure
  test), a compiled abstract subtype's wording (by the subtype wording
  test), an inline variant no entry routes (by the unrouted-variant
  tests) and variants naming one type drawing no collision (by
  TestNames_ReportsEachScope). Two helpers only they used go too.
- openapicases: a keyword read with its object is not split, which the
  core cases' spelling records already hold.

Both packages stay at full statement coverage.
Each test removed here fails on its defect planted narrowly at the
production site it was written for, and so does a test that stays, in
the same package or below it:

- e2e twins of absence-equal keywords, a restating type, a literal
  union's type, one live branch, a referenced union beside a value set,
  a target's bounds reaching an enum, a null default at a union, and
  the fold, content, closure, unevaluated and null-alone reproductions
  whose schema, merge, statement, specrules or reftable tests redden on
  the same plant;
- three keyword-scope tables of a node keyword on an allOf entry, which
  the core schema cases now hold, integer formats included;
- annotation settlement tests whose rules schema or annotation tests
  already pin, fold-report and spelling tests of compilers/openapi and
  openapitest, and a schema null-policy union test.

Where docs/compilers/openapi.md cited a removed test as a rule's
evidence, it now cites the test that reddened on the plant, or drops
the line where the rule already cites it. Each package keeps full
statement coverage; e2e holds no statements of its own.
# Conflicts:
#	compilers/openapi/internal/annotation/pendingkeeps_internal_test.go
Its doc comment said lowerConjunctionUnion routes a union read as alone
elsewhere first, implying lowerCoDeclaredUnion never meets one, though
a valid document reaches that path. It now states what the test holds:
lowerCoDeclaredUnion lowers such a union as written alone, a Union of
two typed branches or the reference a $ref beside null collapses to,
with no finding, and deadBranches marks no branch of a union the body's
conjunction does not choose.
copiesSpec, componentFindings and restatedTree served only tests the
previous commits removed, and the unused linter reports each. They go
with the imports only they needed.
The integer target's format construct adds cases outside the core whose
spellings part from their flat twins as the string target's already
do. 184 write an enum as the second construct on an allOf entry, where
the entry keeps the format verbatim that the flat schema reads, as any
sibling keyword split from its enum across entries does
(entry-value-set). 46 write a oneOf on an entry, where the unread
keywords draw a second degraded report (split-degraded-reports).
merge read the JSON kind of a literal's value with a switch of its own,
beside typeformat.KindsOfValue, and the kinds a node's bounds apply to
through the applies-to table of JSON Schema keywords, beside
ir.ConstraintKeyword.Binds. The two pairs disagreed: an infinity
literal was a string to merge and a number to KindsOfValue, and
precision, scale and patternMessage bounded every kind in merge but
numbers, numbers and strings by Binds, which docs/ir/constraints.md
and docs/ir/enums.md agree with.

nodeInstance now reads a literal through KindsOfValue, taking the
first of merge's kinds whose instances the value may be, and
boundKinds reads each keyword through Binds. merge's InstanceNumber is
any number, where typeformat's is a number with a fraction alone; the
doc comments now say so, and instanceKindsOf's says what it returns
for null.

The OpenAPI compiler writes no infinity literal, precision, scale or
patternMessage, so no compiled document changes.
A union chosen over a second union was read against the rest of its
conjunction by kind alone: the value readings of a union beside an enum
or a const declined wherever a union was passed over. So
{allOf: [{const: b}, {type: string}, {anyOf: [{enum: [b]},
{enum: [c, a]}]}, {oneOf: [{const: a}, {const: c}]}]} lowered to the
Enum of a and c, the const kept, with no warning, though no instance
satisfies it; without the type it lowered to the Literal b.

The rest's value set now takes in what each union passed over admits,
and the three readings that judge a union beside a value set (a union
of value sets, a union of typed branches, a union a $ref lands on) run
beside a union passed over too. A union every member satisfies is kept
there, as the one passed over is, rather than read as saying nothing,
which would have dropped both. Every spelling of the schema above now
lowers as its twin written without the anyOf: the closed empty Enum,
both branches of the oneOf named dead in one warning.

Breaking: the IR of such a schema changes, its node holding only the
members the conjunction admits, the union chosen kept beside it.
Three readers spelled a form as a signed int with a convention:

- ir's tighterEnd took 1 or -1 for the side of a numeric range and
  returned the end, whether one was set and whether it was exclusive
  as three loose values. It takes a rangeSide and returns a rangeEnd
  with comma-ok.
- merge's adopt named the base node -1 to its callback, which
  adoptInto decoded with +1. It now names every node by its index
  among base and the others, base at 0, the index adoptEncoding and
  keepExamples already use, so the callback passes it straight to
  agreeingDeclarations.
- pass's walk down a discriminator hierarchy kept a vertex's nearest
  holder and parent in two lists filled with -1 for unreached. One
  list of arrivals holds both, its zero value an unreached vertex.

No result changes.
A parameter named at made its doc comment read "written at at" or "the
schema node at at", and one comment named a parameter that had been
renamed. Each such parameter the change set wrote outside the schema
lowering is named for what it holds: a pointer, a schema's document
pointer, a declaration's place, a reference site, or the walk path of
a struct or map. viewCommon's comment names combined, its parameter,
and intersectionEntries' no longer says own "stands" for a node,
a word the glossary retires.

No result changes.
A fold report ended "kept what the first says, and the second is kept
verbatim under Unmodeled": the first "kept" meant chosen, a sense the
glossary gives kept no longer, since keeping is writing verbatim into
an Unmodeled entry (docs/ir/README.md#words). It now ends "chose what
the first says; the second is kept verbatim under Unmodeled", and
likewise "chose the one the first gives" and "chose the type the first
gives".

The report of keywords kept apart said they sit "on the node the
field's declarations meet in"; meet is retired for intersection, so it
says "on the node built as the intersection of the field's
declarations".

Only message text changes. Four assertions in the schema package's
tests still name the old wording, and fail until that package's tests
are updated with it.
The 0.74.0 entry left out findings a consumer of 0.73.0 meets anew:

- pass/budget-exceeded, an error, where a run's defaults and examples
  run out of judgments;
- an extension value no JSON holds inside a construct kept whole, an
  openapi/unpreservable-construct error that dropped the construct
  (exit 1) at 4a7a384, now an openapi/degraded-construct warning
  with the construct kept without it (exit 0);
- pass/bounds-admit-no-value for member counts crossed across a
  composition or a cycle of models;
- an allOf naming only itself, a pass/composition-cycle warning on a
  Model at 4a7a384, now an openapi/cyclic-ref error (exit 1);
- the member fold's reports, reworded to name the models and types
  as written and to say chose where they said kept.

It also names openapi/unwidened-nullable a warning. Each is probed at
4a7a384 and cf8eb74 with the spec its bullet quotes.

docs/ir/values.md said the fold adopts a default only on a yes; it
refuses one only on a no and adopts on an unknown, as
merge.fieldFold.adopts does. docs/cli.md and CLAUDE.md said "kept"
and "stands" where they meant chosen and the member's pointer.
Four schema tests asserted the fold report's old wording, "kept what
the first says, and the second ..." and "kept the one the first
gives". They expect "chose" now, as the report says, and one
assertion's message says the chosen one where it said the kept one.
The kinds an `if` leaves were read from its `then` and `else` by their
`type` alone, and a branch writing anything else, a maxLength or a
required among it, read as admitting no kind. So
{if: {type: string}, then: {maxLength: 2}} read as admitting no
string: {type: string, anyOf: [that, {type: integer}]} drew a false
"no value satisfies both the type and the anyOf", the same beside
enum: [abc, x], and an allOf of an object entry and
{if: {type: object}, then: {required: [a]}} lowered to a Scalar over
the entry's Model where its flat twin is the Model.

The branches are now edges of the admission walk, the one reader of
what a schema admits that every other position uses, and the `if`
sends each kind to the branch its condition decides, as that branch
admits it, whole or in part. A keyword narrowing within a kind removes
none, a branch read loosely or left unsettled on its own cycle is not
followed, and the type-only reader is left to `not` alone.

Breaking: such an allOf lowers to its Model, and a union beside such a
branch reports the branches that share no value, not the whole union.
Conflicts, resolved by carrying each side's intent:

- design-rules.md: name-what-it-holds cites both one-sense-per-word
  and main's normative-term-outranks-figurative; decide-once,
  one-rule-one-implementation and fold-the-whole-set take main's move
  to deciding-once.md, whose Why names no file, so the branch's
  renamed path there is moot.
- finding-cost.md: the measuring rules take main's move to
  reading-a-run.md, carrying the branch's "no substitute" for the
  retired "no stand-in".
- testing.md: main's two new guard rules, then the branch's heading
  "stays where it keeps a reading whole".
- CLAUDE.md: main's naming bullet, followed by the branch's sentence
  on the glossaries' one sense per word.
- testnames_test.go: main's wording of testNamePlaceholders' comment,
  with the branch's "refer to" for the retired "stand for".
The rules main gained in #2379 wrote words the glossary that opens
docs/compilers/openapi.md retires: "stand" (a stand-in, a count that
stands out), "meet" for an intersection and "reach" for a keyword
scope. They now say stub, as tests-that-bite.md already does, "is
well above the rest", the intersection and the keyword scope. The key
test-first-against-a-stand-in keeps its word, as rule keys do.
A discriminator an inline allOf entry writes lowers onto the Model the
allOf composes, as one written beside the allOf. The node kept none of
what the object writes that reaches no IR field: its x- extensions and
the keys OpenAPI defines for no Discriminator Object, such as
`required: [dogType]` and `x-ext: 1`, were dropped, where the twin
written beside the allOf keeps them under openapi:discriminator/<key>,
as out_of_scope and vendor_extension.

The node holding such a discriminator now keeps them as the twin does,
under the same keys and reasons, each at the pointer it is written at.
A discriminator kept whole holds them instead, as the twin's does.
The comment grew past the 100-word cap when the reading of an if's
branches moved to the admission walk; it drops a clause the code says.
A union of value sets beside a body stating none, such as
{type: string, oneOf: [{const: a, title: A, description: dA,
deprecated: true}, {const: b, title: B, description: dB}]}, lowers to
the Enum of the members the body admits. Its members held no docs or
deprecation, and the union was kept as validation_only whatever it
said, while the union written alone gives each member what its branch
says of it.

Each member, or the Literal of one where the members are of several
kinds, now holds what the branch writing it alone, by a const or an
enum of one, says of it: its docs, deprecation, examples and
extensions, read as that branch written alone is read. A member two
branches write takes the notes of neither, so no order of them
chooses. The union is kept nowhere where the node holds all it
writes, once as validation_only where a branch says of its members
what none holds, and degraded where a branch holds no member, as
before.

Breaking: such members carry their branches' notes, and a union the
node holds whole is no longer kept beside it.
The comment on the if-branch reading test now says a branch leads
back to the schema writing it, as the other tests of the walk say it.
A union of value sets beside a body stating none, every branch of
which the node holds, is no longer kept beside the Enum of its
members; the end-to-end tests that held it kept as validation logic
now hold it kept nowhere, with the flat twin's findings alone.
The admission walk's settle now reads an if and its branches through
conditionalRead, which calls conditionRead itself, so the method edge
the call-graph test holds to is settle to conditionalRead.
A union judged against the value set an enum beside it states, such
as {enum: [a, b], oneOf: [{const: a, description: dA, deprecated:
true}, {const: b, description: dB}]}, lowered to the Enum of the set
with no docs or deprecation on its members, the union kept as
degraded_lowering, while the union written alone, and beside a body
stating no set, gives each member what its branch says of it.

Each member of the enum, or its Literal where the members are of two
kinds, now holds what the branch writing it alone, by a const or an
enum of one, says of it, whether the union's branches are value sets
or some are typed. Where the enum, written inline and by no const,
holds all the union says, the members it narrows the enum to among
it, the union is kept nowhere, as a union every member satisfies is
not; a branch saying of several members what none holds, or holding
none of them, keeps it as before. A note beside a const or a set a
$ref names stays with the union kept, as no member there holds it.

Breaking: such members carry their branches' notes, and a union the
node holds whole is no longer kept beside it.
A union some branch of which is no value set, chosen over a second
union that leaves the rest's value set no member, was read by its
branches' kinds. So {const: b, type: string, anyOf: [{enum: [c]},
{enum: [d]}], oneOf: [{const: c, minLength: 1}, {const: b}]} lowered
to the Union of the literals c and b, with no warning, though no
instance satisfies it, where the same schema with a oneOf of value
sets lowers to the closed empty Enum with its dead branches named.

Such a union is now read as a union of value sets there is: no branch
shares a value with the rest, so each is named dead in one warning,
and the position is the closed empty Enum keeping the const and both
unions.

Breaking: such a schema lowers to the closed empty Enum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment