api-platform / api-platform/core
Add multi-language OpenAPI specification
- 主要語言
- PHP
- 星號
- 2.6k
- 分支
- 980
- 平均合併
- 2 天 4 小時
- 30 天內合併 PR
- 49
描述
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 還沒有評估資料。