Skip to content

A $ref'd schema's constraints are not copied to the use site, while docs and default are #428

Description

@fuad-daoud

The gap

At a $ref use site, the compiler copies some declared facts down from the referent and not others. testdata/conformance/openapi/param-ref-inheritance.yaml:31-32 exercises the inheriting half: documentation, deprecation and default reach the use site.

Constraints do not.

Why it matters

The asymmetry is undocumented in the field docs, so a consumer reading a use site's Constraints gets an empty struct and cannot tell "no constraints were declared" from "constraints were declared on the referent". For anything comparing two documents that is a silent false negative: a change to a shared component's maxLength is invisible at every site that references it.

Suggested fix

Either copy constraints the way docs and defaults are copied, or document the split explicitly in the Constraints and TypeRef field docs, saying which facts inherit through a reference and which must be read from the target.


Found by a study of dexpace/spaceapi adopting morphic IR as its input format (spaceapi#56), 2026-09-05. Related: #418 (non-emitter consumer), #419 (cross-revision identity).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugDefect in shipped behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions