api-platform / api-platform/core
Add multi-language OpenAPI specification
- 主要语言
- PHP
- 星标
- 2.6k
- 派生
- 980
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 51
描述
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.
贡献指南
评估
这个 Issue 还没有评估数据。