fix: specs generation for nullable params
This commit is contained in:
parent
2178bfc126
commit
2f1dda891b
2 changed files with 16 additions and 4 deletions
|
@ -285,9 +285,11 @@ class OpenAPI3 extends Format
|
|||
}
|
||||
}
|
||||
|
||||
if ($validator instanceof Nullable) {
|
||||
$isNullable = $validator instanceof Nullable;
|
||||
|
||||
if ($isNullable) {
|
||||
/** @var Nullable $validator */
|
||||
$validator = $validator->getValidator();
|
||||
$node['schema']['x-nullable'] = true;
|
||||
}
|
||||
|
||||
switch ((!empty($validator)) ? \get_class($validator) : '') {
|
||||
|
@ -455,6 +457,10 @@ class OpenAPI3 extends Format
|
|||
if ($node['x-global'] ?? false) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-global'] = true;
|
||||
}
|
||||
|
||||
if ($isNullable) {
|
||||
$body['content'][$consumes[0]]['schema']['properties'][$name]['x-nullable'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$url = \str_replace(':' . $name, '{' . $name . '}', $url);
|
||||
|
|
|
@ -286,9 +286,11 @@ class Swagger2 extends Format
|
|||
}
|
||||
}
|
||||
|
||||
if ($validator instanceof Nullable) {
|
||||
$isNullable = $validator instanceof Nullable;
|
||||
|
||||
if ($isNullable) {
|
||||
/** @var Nullable $validator */
|
||||
$validator = $validator->getValidator();
|
||||
$node['schema']['x-nullable'] = true;
|
||||
}
|
||||
|
||||
switch ((!empty($validator)) ? \get_class($validator) : '') {
|
||||
|
@ -454,6 +456,10 @@ class Swagger2 extends Format
|
|||
$body['schema']['properties'][$name]['x-global'] = true;
|
||||
}
|
||||
|
||||
if ($isNullable) {
|
||||
$body['schema']['properties'][$name]['x-nullable'] = true;
|
||||
}
|
||||
|
||||
if (\array_key_exists('items', $node)) {
|
||||
$body['schema']['properties'][$name]['items'] = $node['items'];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue