Skip to content

fix(openapi): add generated schema to custom request body media types - #8669

Open
bram123 wants to merge 1 commit into
api-platform:5.0from
bram123:requestbody_mediatype_schema_examples
Open

bram123 wants to merge 1 commit into
api-platform:5.0from
bram123:requestbody_mediatype_schema_examples

Conversation

@bram123

@bram123 bram123 commented Oct 11, 2026

Copy link
Copy Markdown
Q A
Branch? 5.0 for bug fixes
Tickets Closes #8661
License MIT
Doc PR

When providing a custom RequestBody with content on an operation (for example, to configure OpenAPI examples on request payloads), OpenApiFactory previously discarded the automatically generated input schemas..

Now the MediaType is merged with the generated data, when no schema value is set.
If only a subset of request mimeTypes are customized, all expected types get the schema

Added functional test case testRequestBodyExamplesRetainAutoGeneratedSchema (using the RequestBodyWithExamplesResource fixture class), asserting all requested mimetypes are added and have a schema set, with the two customized mimetypes having the schema added to the existing mimetype dataset.

@bram123 bram123 changed the title fix(openapi): retain generated schema when custom request body media … fix(openapi): add generated schema to custom request body media types Oct 11, 2026
@soyuka

soyuka commented Oct 12, 2026

Copy link
Copy Markdown
Member

I'm not sure that this is possible, if you need this put it in a custom openapi factory. I think that when you have a custom request body it's desired that we don't override anything, indeed we can't really predict that you'll answer the output that are configured on "standard" objects.

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