Skip to content

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

Merged
soyuka merged 1 commit into
polymorphism/2-serializerfrom
polymorphism/3-jsonschema
Nov 27, 2026
Merged

soyuka merged 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.

@soyuka
soyuka added this pull request to stack #8889 November 26, 2026 17:08
@soyuka
soyuka force-pushed the polymorphism/3-jsonschema branch from c7555d1 to 10d5ae2 Compare November 27, 2026 09:30
@soyuka
soyuka force-pushed the polymorphism/3-jsonschema branch 2 times, most recently from 04ae164 to 1947801 Compare November 27, 2026 10:43
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>
@soyuka
soyuka force-pushed the polymorphism/3-jsonschema branch from 1947801 to 019dbb0 Compare November 27, 2026 14:55
@soyuka
soyuka removed this pull request from stack #8889 November 27, 2026 14:56
@soyuka
soyuka added this pull request to stack #8896 November 27, 2026 14:56
@soyuka
soyuka merged commit 2c01934 into main Nov 27, 2026
78 of 231 checks passed
@soyuka
soyuka deleted the polymorphism/3-jsonschema branch November 27, 2026 14:56
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