api-platform / api-platform/core

Add multi-language OpenAPI specification

Abierto
#5,785 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 4 h
PR fusionados (30 d)
49

Descripción

I need multi-language API documentation. For now possible to generate single language only (which use in resource files).
How better to implement it? Build instance of `ApiPlatform\OpenApi\OpenApi` with already translated field or do translation during normalization in `ApiPlatform\OpenApi\Serializer\ApiGatewayNormalizer`?

I think better to translate OpenApi instance and propose to implement `OpenApiFactoryInterface` decorator in follow way:

```
// OpenApiTranslator.php

decorated)($context);
return $this->translator->translate($openApi, $lang);
}
}
```

and fix commad `api:openapi:export` command to check which translation available (or add some argument) and generate translated OpenAPI specifications with some suffix in the filename, e.g. 'openapi_en.json', 'openapi_de.json' and etc.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.