You are here

public function RestGenerator::getTags in OpenAPI 8

Get tags.

Overrides OpenApiGeneratorBase::getTags

File

src/Plugin/openapi/OpenApiGenerator/RestGenerator.php, line 130

Class

RestGenerator
Defines an OpenApi Schema Generator for the Rest module.

Namespace

Drupal\openapi\Plugin\openapi\OpenApiGenerator

Code

public function getTags() {
  $entity_types = $this
    ->getRestEnabledEntityTypes();
  $tags = [];
  foreach ($entity_types as $entity_type) {
    if ($this
      ->includeEntityTypeBundle($entity_type
      ->id())) {
      $tag = [
        'name' => $entity_type
          ->id(),
        'description' => $this
          ->t("Entity type: @label", [
          '@label' => $entity_type
            ->getLabel(),
        ]),
        'x-entity-type' => $entity_type
          ->id(),
        'x-definition' => [
          '$ref' => '#/definitions/' . $this
            ->getEntityDefinitionKey($entity_type
            ->id()),
        ],
      ];
      $tags[] = $tag;
    }
  }
  return $tags;
}