Skip to content

openapi: a promotion mapping can't say which extension values state the fact #654

Open

Description

@OmarAlJarrah

Problem

Extensions that state openness often do it with a value: allow or disallow, true or false, or a small vocabulary. extensionOpenness (compilers/openapi/internal/lowering/promotion.go:235) treats any value that isn't a boolean as "open":

openapi.Options{Promotions: openapi.ExtensionPromotions{Targets: map[string]openapi.ExtensionTarget{
    "x-unknown-values": openapi.TargetEnumOpen,
}}}
Status: {type: string, enum: [a, b], x-unknown-values: disallow}

Status compiles to closed: false with inferred: extension-promotion: the document said the opposite. A caller has no way to state which values mean open, and nothing reports a value the mapping doesn't understand.

Proposal

Let a mapping entry name the values that state the fact, for example {target: enum.open, when: [allow]}, and report any other value instead of reading it. The rule of docs/compilers/openapi.md#extension-promotion that a value the field can't hold is reported and not coerced then covers these keys too.

Activity

  1. added
    priority:P3Later emitters, M4 and up, 3.2-only, streaming, webhooks, rare constructs
    on Oct 19, 2026
  2. OmarAlJarrah commented on Nov 1, 2026

    @OmarAlJarrah
    MemberAuthor

    #1229 adds an instance on another target. TargetDeprecation takes the text deprecated or a boolean true, which is right for a key meaning only that, and the two stability keys are read as sources of it for their word deprecated. A mapping cannot narrow a source to that word, so x-stability: true creates a Deprecation, marked extension-promotion, with nothing reported, where the document likely means something else.

    The value set this issue proposes would settle it. The golden spec writes no boolean under either key: x-stability is beta 280 times and stable twice (spec @319dc756). docs/compilers/openapi.md#extension-promotion names this in its Status.

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

    priority:P3Later emitters, M4 and up, 3.2-only, streaming, webhooks, rare constructstype:bugDefect in shipped behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions