-
-
Notifications
You must be signed in to change notification settings - Fork 356
Open
Labels
Description
Scribe version
5.4.0
PHP version
8.4
Laravel version
12.35.0
Scribe config
n/aWhat happened?
Currently the OpenAPI generation ignores the nullable parameter for ResponseFields. (which is valid for OpenAPI 3.0)
After digging the sources a naive "fix" would be:
- Add
public $nullable;tocamel/Extraction/ResponseField.php - Under
generateSchemaForResponseValue()insrc/Writing/OpenApiSpecGenerators/BaseGenerator.phpadd
L568
$this->setDescription($schema, $endpoint, $path);
//either it's explicitly nullable or the value is null (don't know if this is legit?)
if ((isset($endpoint->responseFields[$path]->nullable) && $endpoint->responseFields[$path]->nullable) || $value === null) {
$schema['nullable'] = true;
}
However I also stumbled over you comment here https://scribe.knuckles.wtf/laravel/migrating#more-configurable-openapi-generation - would it be possible and do you recommend to use this approach to add the nullable parameter to responseField? Or do you prefer an enhancement like the above code?
Docs
- I've checked the docs, the troubleshooting guide, and existing issues, but I didn't find a solution