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

Endpoind parameters are translated even if they should not #1331

Closed
drenda opened this issue Nov 8, 2021 · 6 comments
Closed

Endpoind parameters are translated even if they should not #1331

drenda opened this issue Nov 8, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@drenda
Copy link

drenda commented Nov 8, 2021

Describe the bug
After updating the library from 1.5.10 to 1.5.12, the openapi.json file has some issues on the parameter's name. It seems they are translated using i18n using the messages.properties file.

I see you introduced the i18n support but I don't expect parameter's name are translated.

To Reproduce
This is the endpoint configuration:

@Operation(summary = "Get the profit and margin metrics")
   @ApiResponses(value = {
           @ApiResponse(responseCode = "200", description = "Successful operation"),
           @ApiResponse(responseCode = "400", description = "Invalid input"),
           @ApiResponse(responseCode = "401", description = "Not authorized"),
           @ApiResponse(responseCode = "404", description = "If the resource has not been found"),
           @ApiResponse(responseCode = "500", description = "Internal server error"),
   })
   @GetMapping(value = "/salesMetrics/profitMargin", produces = MediaType.APPLICATION_JSON_VALUE)
   ResponseEntity<ProfitMarginMetricDTO> getProfitMarginMetrics(@RequestHeader("TimeZone") String timeZone, @Parameter(description = "The start date", required = true) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(name = "from") LocalDate from, @Parameter(description = "The end date", required = true) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(name = "until") LocalDate until);

Expected behavior

  • I expect the paramert's names are "from" and "until". Instead "from" parameter is translated to "da" (in Italian). This is the relevant generated JSON:
"/api/v1/salesMetrics/profitMargin": {
      "get": {
        "tags": [
          "SalesMetric"
        ],
        "summary": "Get the profit and margin metrics",
        "operationId": "getProfitMarginMetrics",
        "parameters": [
          {
            "name": "TimeZone",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "da",
            "in": "query",
            "description": "The start date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "The end date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],

Additional context
In my messages.properties I've the value "from" and the Italian translation of it is "da"

@bnasslahsen
Copy link
Contributor

Hi @drenda,

Starting from the next release v1.5.13, you will be able to disable this default behavior using the following property:

springdoc.disable-i18n=true

@drenda
Copy link
Author

drenda commented Nov 11, 2021

Thanks for the reply. Could you explain me the idea behind the parameter translations?

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Nov 11, 2021

it's based on i18n.
You can see the tests for more details...

@drenda
Copy link
Author

drenda commented Nov 19, 2021

Hi @drenda,

Starting from the next release v1.5.13, you will be able to disable this default behavior using the following property:

springdoc.disable-i18n=true

Do you have an ETA for the next release date? Thanks

@bnasslahsen
Copy link
Contributor

By the EOM!

@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
@chenxinss
Copy link

Hi @drenda,
Starting from the next release v1.5.13, you will be able to disable this default behavior using the following property:

springdoc.disable-i18n=true

Do you have an ETA for the next release date? Thanks

I also encountered a similar problem.
@ The Tag @ Operation tag is invalid, and debugging found that
i18n internationalization has lost the values of these two tags.
I used this configuration that disabled i18n to solve the problem
springdoc.disable-i18n=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants