Skip to content

fix(jsonschema): keep property metadata on reference schemas - #8480

Merged
soyuka merged 1 commit into
api-platform:4.3from
gaetan-petit:fix/jsonschema-keep-property-metadata-8453
Sep 2, 2026
Merged

fix(jsonschema): keep property metadata on reference schemas#8480
soyuka merged 1 commit into
api-platform:4.3from
gaetan-petit:fix/jsonschema-keep-property-metadata-8453

Conversation

@gaetan-petit

Copy link
Copy Markdown
Contributor
Q A
Branch? 4.3
Tickets Closes #8453
License MIT

Properties typed after another class lost their description, default, example, readOnly and validator restrictions: buildPropertySchema() reset the schema on an unresolved type, then replaced it with the $ref or anyOf instead of writing into it.

The reset now drops only the unresolved-type keys, and the reference branches assign into the schema, as buildLegacyPropertySchema() already does.

AI disclosure:
Review and test were done by Claude. I reviewed and tested everything.

@gaetan-petit
gaetan-petit marked this pull request as draft August 26, 2026 12:10
@gaetan-petit
gaetan-petit force-pushed the fix/jsonschema-keep-property-metadata-8453 branch from 3ecc83a to 73d7da1 Compare August 26, 2026 12:35
@gaetan-petit
gaetan-petit marked this pull request as ready for review August 26, 2026 12:38
@gaetan-petit gaetan-petit changed the title fix(jsonschema): keep property metadata next to $ref schemas fix(jsonschema): keep property metadata on reference schemas Aug 26, 2026
@gaetan-petit
gaetan-petit marked this pull request as draft August 26, 2026 12:44
@gaetan-petit
gaetan-petit force-pushed the fix/jsonschema-keep-property-metadata-8453 branch from 73d7da1 to 823533b Compare August 26, 2026 12:48
@gaetan-petit
gaetan-petit marked this pull request as ready for review August 26, 2026 12:59
@soyuka

soyuka commented Sep 1, 2026

Copy link
Copy Markdown
Member

I like this change thanks!

@soyuka
soyuka force-pushed the fix/jsonschema-keep-property-metadata-8453 branch from 823533b to eb239b2 Compare September 1, 2026 14:12
buildPropertySchema() reset the property schema on an unresolved type,
then replaced it with the `$ref` or `anyOf` instead of writing into it,
dropping `description`, `default`, `example`, `readOnly` and the
validator restrictions.

Closes api-platform#8453
@soyuka
soyuka force-pushed the fix/jsonschema-keep-property-metadata-8453 branch from eb239b2 to e589972 Compare September 2, 2026 08:02
@soyuka
soyuka merged commit 9a6a684 into api-platform:4.3 Sep 2, 2026
110 of 112 checks passed
@gaetan-petit
gaetan-petit deleted the fix/jsonschema-keep-property-metadata-8453 branch September 2, 2026 11:53
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.

2 participants