Repository navigation
Description
Problem
A value set written on an allOf entry of its own, beside an entry whose $ref names nothing, composes a Model, where the same value set written beside the $ref or beside the allOf lowers as the value set keeping the $ref.
openapi: 3.1.0
info: {title: t, version: "1"}
paths: {}
components:
schemas:
Beside: {$ref: '#/components/schemas/Missing', enum: [a]}
Wrap: {allOf: [{$ref: '#/components/schemas/Missing'}], enum: [a]}
Entry: {allOf: [{$ref: '#/components/schemas/Missing'}, {enum: [a]}]}$ morphic compile --diag-limit 0 spec.yaml >ir.json; echo "exit $?"
error openapi/unresolved-ref spec.yaml#/components/schemas/Beside: unresolved $ref "#/components/schemas/Missing": […]
error openapi/unresolved-ref spec.yaml#/components/schemas/Entry/allOf/0: unresolved $ref "#/components/schemas/Missing": […]
error openapi/unresolved-ref spec.yaml#/components/schemas/Wrap/allOf/0: unresolved $ref "#/components/schemas/Missing": […]
exit 1
$ jq -c '.types | to_entries[] | select(.key | test("schemas/(Beside|Wrap|Entry)$")) | {id: (.key | split("/") | last), kind: .value.kind, unmodeled: (.value.unmodeled // {} | map_values(.reason))}' ir.json
{"id":"Beside","kind":"enum","unmodeled":{"openapi:$ref":"degraded_lowering"}}
{"id":"Entry","kind":"model","unmodeled":{"openapi:$ref":"degraded_lowering","openapi:enum":"degraded_lowering"}}
{"id":"Wrap","kind":"enum","unmodeled":{"openapi:$ref":"degraded_lowering"}}The document is refused in every spelling, as it should be, and nothing it writes is lost. What differs is the IR a caller gets beside the error: Entry is a Model, an object type for a schema whose one readable conjunct is a set of strings. On main (at 9562ea4) Entry is a Model too, Wrap an Enum and Beside an alias keeping the enum.
Cause
A reference that names nothing cuts the read of the conjunction short, and a position whose read is cut short composes as before, whatever its other entries say (compilers/openapi/internal/schema, the election of an allOf's conjuncts, at 92d4bbe). The spellings with the value set beside the $ref or the allOf elect the value set first.
Direction
A draft: elect an inline value set on an entry before the cut read decides, as beside the allOf. The alternative is to leave it: an allOf entry whose own $ref names nothing is read whole by a recorded decision, and this is the IR of a refused document.
Out of scope
- An entry writing the
$refand the value set together,{allOf: [{$ref: Missing, enum: [a]}]}, which is read whole.
Priority: P4, rule 2 (the IR of a document refused for an unresolved reference). No count on the golden spec applies: it compiles with no openapi/unresolved-ref (morphic validate openapi.json) (spec @8b1a4518, morphic @92d4bbee3).
Activity
test: hold a pending test to the issue it waits for
OmarAlJarrah commentedon Nov 30, 2026
Fixed in #2354 at 7213104, which closes this on merge. A value set is now elected before anything is read, so a
$refnaming nothing no longer decides the node:Entryis theEnum [a]keepingopenapi:$ref, asBesideandWrapare, with the oneopenapi/unresolved-referror and no other finding.