KEMBAR78
fix(openapi): Improve response override by VincentLanglet · Pull Request #7428 · api-platform/core · GitHub
Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

Q A
Branch? 4.2 like #7412 ?
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

cc @soyuka This is a followed up of #7412 to have a 100% consistent behavior with the RequestBody override.

When you override the RequestBody:

  • Without description, it use the default one
  • With a '' description, it use ''

After #7412

  • If you override the response without a description, it use ''
  • If you override the response with an explicit '', it use ''

So you cannot rely on the default description provided by the OpenAiFactory.
On the opposite, just adding

if (!$response->getDescription()) {
     $response = $response->withDescription($description);
}

will remove the ability to "hide" the description by voluntary setting ''. Feature which is possible on RequestBody.

So the only way is to use a nullable description on Response (same way it's nullable on RequestBody).

  • Null means use the defaut value from OpenAiFactory
  • '' means use nothing

@soyuka soyuka changed the title fix(openai): Improve response override fix(openapi): Improve response override Sep 30, 2025
@soyuka soyuka merged commit 654339e into api-platform:4.2 Sep 30, 2025
113 of 114 checks passed
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