Skip to content

feat(jsonschema): document discriminator maps as oneOf - #8885

Open
soyuka wants to merge 1 commit into
polymorphism/2-serializerfrom
polymorphism/3-jsonschema
Open

soyuka wants to merge 1 commit into
polymorphism/2-serializerfrom
polymorphism/3-jsonschema

Conversation

@soyuka

@soyuka soyuka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main
Tickets
License MIT
Doc PR

A class with a serializer discriminator map is documented as a oneOf of its subtypes with an OpenAPI discriminator. Resources only when polymorphism is enabled, non-resource inputs always. Builds on #8879 by @dunglas.

Test: tests/Functional/DiscriminatorMapOpenApiTest.php, src/JsonSchema/Tests/SchemaFactoryTest.php

Part 3/6 of the polymorphism stack (#8889), replaces #8874.

A resource with a serializer discriminator map is documented as a
`oneOf` of its subtypes with a `discriminator` in JSON Schema, JSON:API
and OpenAPI.

Co-authored-by: Kévin Dunglas <kevin@dunglas.dev>
Co-authored-by: Dylan van der Hout <dylan@rumble.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant