Skip to content

Support discriminator for oneOf in OpenApiValidationPlugin #2040

Open

Description

@waldekmastykarz

OpenApiValidationPlugin (#2037) validates oneOf strictly: a body that matches more than one branch is reported. That's correct per spec, but many real-world specs have overlapping oneOf branches and rely on discriminator to pick one, so valid payloads get flagged.

Proposal: when a discriminator is present, select the branch from the discriminator property's value, using mapping (or the implicit schema name if there's no mapping), and validate only that branch. Report a clear error when the discriminator value is missing or unknown.

Depends on #2037.

Activity

  1. added a commit that references this issue on Oct 31, 2026
    c8ca15e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions