Found in review of #436 (Wahbeh-Mohammad).
keepLosingType writes the discarded ir.TypeRef as the Unmodeled value:
{"target":"t/prim/string","nullable":false}
ir/unmodeled.go and ir-design §12 define Value as "the source construct, verbatim". A TypeID is a compiler-minted registry ID, not source. This is the only site under compilers/ that marshals an IR struct into an Unmodeled payload.
The precedent cited in the code does not hold: annotation/constraints.go writes back a BigVal because a BigVal is the source literal text. A TypeID has no such property.
Two consequences:
irverify's reference walk (collectRefs) visits only string-kinded registry types. RawValue is a byte slice, so this reference can never be reported dangling. In allof-conflicting-type.golden.json, t/prim/string has zero live TypeRef referents; a future registry-pruning pass would orphan it and nothing would redden.
- Where the losing branch carries residue (
maxProperties and friends), preserveUnmergedBranch already keeps the whole branch node verbatim under openapi:allOf/<i>, so the loser would be preserved twice in two incompatible representations. The current fixture does not exhibit this because both branches declare only type: object plus properties.
Suggested fix: schema.go still holds the losing property's raw node (js in the props.All() loop) at the MergeProperty call. Pass it through and preserve those bytes. Alternatively, amend §12 and ir/unmodeled.go to permit an IR-value form and say why.
Deferred from #436 deliberately: it changes MergeProperty's signature and the golden, where #436's scope is the #424 fix.
Found in review of #436 (Wahbeh-Mohammad).
keepLosingTypewrites the discardedir.TypeRefas the Unmodeled value:{"target":"t/prim/string","nullable":false}ir/unmodeled.goand ir-design §12 defineValueas "the source construct, verbatim". ATypeIDis a compiler-minted registry ID, not source. This is the only site undercompilers/that marshals an IR struct into an Unmodeled payload.The precedent cited in the code does not hold:
annotation/constraints.gowrites back aBigValbecause aBigValis the source literal text. ATypeIDhas no such property.Two consequences:
irverify's reference walk (collectRefs) visits only string-kinded registry types.RawValueis a byte slice, so this reference can never be reported dangling. Inallof-conflicting-type.golden.json,t/prim/stringhas zero liveTypeRefreferents; a future registry-pruning pass would orphan it and nothing would redden.maxPropertiesand friends),preserveUnmergedBranchalready keeps the whole branch node verbatim underopenapi:allOf/<i>, so the loser would be preserved twice in two incompatible representations. The current fixture does not exhibit this because both branches declare onlytype: objectplusproperties.Suggested fix:
schema.gostill holds the losing property's raw node (jsin theprops.All()loop) at theMergePropertycall. Pass it through and preserve those bytes. Alternatively, amend §12 andir/unmodeled.goto permit an IR-value form and say why.Deferred from #436 deliberately: it changes
MergeProperty's signature and the golden, where #436's scope is the #424 fix.