You are here

protected function OpenApiGeneratorBase::cleanSchema in OpenAPI 8

Same name and namespace in other branches
  1. 8.2 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.

1 call to OpenApiGeneratorBase::cleanSchema()
OpenApiGeneratorBase::getJsonSchema in src/Plugin/openapi/OpenApiGeneratorBase.php
Gets the JSON Schema for an entity type or entity type and bundle.

File

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

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;
}