Skip to content
Snippets Groups Projects
Commit d1f4556c authored by Rich Gerdes's avatar Rich Gerdes Committed by Rich Gerdes
Browse files

Issue #2903630 by richgerdes, segovia94:...

Issue #2903630 by richgerdes, segovia94: OpenApiGeneratorBase->fixDefaultFalse() throwing undefined index error
parent f3c94930
No related branches found
No related tags found
No related merge requests found
......@@ -351,13 +351,15 @@ abstract class OpenApiGeneratorBase extends PluginBase implements OpenApiGenerat
* JSON Schema field value.
*/
protected function fixDefaultFalse(array &$value) {
if (isset($value['type']) && $value['type'] == 'array'
&& is_array($value['items']['properties'])
) {
$type_is_array = isset($value['type']) && $value['type'] === 'array';
$has_properties = isset($value['items']['properties']) && is_array($value['items']['properties']);
if ($type_is_array && $has_properties) {
foreach ($value['items']['properties'] as $property_key => $property) {
if ($property['type'] == 'boolean') {
if (isset($value['default'][0][$property_key]) && empty($value['default'][0][$property_key])) {
$value['default'][0][$property_key] = FALSE;
if ($property['type'] === 'boolean') {
foreach ($value['default'] as &$default_values) {
if (isset($default_values[$property_key]) && empty($default_values[$property_key])) {
$default_values[$property_key] = FALSE;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment