You are here

protected function OpenApiGeneratorBase::cleanSchema in OpenAPI 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/openapi/OpenApiGeneratorBase.php \Drupal\openapi\Plugin\openapi\OpenApiGeneratorBase::cleanSchema()

Cleans JSON schema definitions for OpenAPI.

@todo Just to test if fixes https://github.com/OAI/OpenAPI-Specification/issues/229

Parameters

array $json_schema: The JSON Schema elements.

Return value

array The cleaned JSON Schema elements.

File

src/Plugin/openapi/OpenApiGeneratorBase.php, line 378

Class

OpenApiGeneratorBase
Defines base class for OpenApi Generator plugins.

Namespace

Drupal\openapi\Plugin\openapi

Code

protected function cleanSchema(array $json_schema) {
  foreach ($json_schema as &$value) {
    if ($value === NULL) {
      $value = '';
    }
    else {
      if (is_array($value)) {
        $this
          ->fixDefaultFalse($value);
        $value = $this
          ->cleanSchema($value);
      }
    }
  }
  return $json_schema;
}