Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better support for locale when using "new OpenAPI()" #1360

Closed
ianwallen opened this issue Dec 3, 2021 · 1 comment
Closed

Add better support for locale when using "new OpenAPI()" #1360

ianwallen opened this issue Dec 3, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@ianwallen
Copy link
Contributor

ianwallen commented Dec 3, 2021

Is your feature request related to a problem? Please describe.
Trying to create a new locale application where we are creating the OpenAPI (new OpenAPI().info(new Info()..) as a new object instead of using annotations (@OpenAPIDefinition(info = @Info(...)

It was noticed that data from @OpenAPIDefinition is translated however data from new OpenAPI() is not translated when the locale changes.

It is not known if there already exists a way to have i8n support when using new OpenAPI()?

Describe the solution you'd like
Since it is difficult to apply logic within annotations values, if the api title or version or url needs to be provided at runtime then the logic needs to be applied using the new OpenAPI(). It would be nice if there was support for i8n when creating a new OpenAPI() object.

I don't know how this would need to be implemented?

Describe alternatives you've considered

  • I can't think of any other solution.

Additional context
I have created a unit test app171b in the following branch that shows a case where the locale fails.
https:/ianwallen/springdoc-openapi/tree/locale_non_annotated_issue

Based on how the new feature is implemented, the unit test would need to be changed.

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Dec 5, 2021

@ianwallen,

As the Locale support was only introduced in springdoc-openapi and not available by default in the swagger-core to which OpenAPI class belongs and the access to locale value is only available at runtime. The simplest solution is to introduce a dedicated customizer unless you have better proposal.

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants