I'm using the following dependences in my Spring boot project :
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-security</artifactId>
<version>1.6.6</version>
</dependency>
Amongst other annotations, I've configured the Swagger UI part thanks the following one :
@OpenAPIDefinition(
info = @Info(
title = OpenApiConfig.API_TITLE,
description = OpenApiConfig.API_DESCRIPTION,
version = OpenApiConfig.API_VERSION
),
security = {
// Activate by default the previously defined security schemes on all endpoints
// You can selectively disable all of them by placing an empty @SecurityRequirement
@SecurityRequirement( name = OpenApiConfig.OAUTH2_JWT_TOKEN_SECURITY_SCHEME ),
@SecurityRequirement( name = OpenApiConfig.API_KEY_SECURITY_SCHEME )
}
)
public class OpenApiConfig {
public static final String OAUTH2_JWT_TOKEN_SECURITY_SCHEME = "JWT token request";
public static final String API_KEY_SECURITY_SCHEME = "Api key (only for API Portal's swagger)";
...
This lead the open API endpoint ( /v3/api-docs ) producing the following JSON except :
{
"openapi": "3.0.1",
"info": { ... },
"servers": [ ... ],
"security": [
{
"JWT token request": []
},
{
"Api key (only for API Portal's swagger)": []
}
],
"paths": { ... },
"components": {
...,
"securitySchemes": {
"Api key (only for API Portal's swagger)": {
"type": "apiKey",
"name": "X-Api-Key",
"in": "header"
},
"JWT token request": {
"type": "oauth2",
"flows": {
"authorizationCode": {
....
Unfortunately, the previous exerpt is the cause of a complain when it's loaded in Swagger UI Editor :

At my job, the team in charge of the API Management portal told me it's because of this error message that the Open API contract produced by my endpoint fails been loaded on the API Management portal's APIs catalog.
Of course, I could change my two parameters OAUTH2_JWT_TOKEN_SECURITY_SCHEME and API_KEY_SECURITY_SCHEME to have the whole thing conforming to our Swagger UI display tool requirements.
But on the other hand, I'd like to keep the possibility to controle the way those credentials are labeled when they are displayed in the "Try it" popup window that request thoses credentials :

This way it will be more user friendly.
Is their a way to achieve this, and if not, is it possible to make an enhancement to have the produced Open API v3 json document meeting both of previous requirements ? :
- The ones mentionnent in the Swaggerr UI Editor
- And mines
Thanks in advance for your consideration about my request
Best regards
I'm using the following dependences in my Spring boot project :
Amongst other annotations, I've configured the Swagger UI part thanks the following one :
This lead the open API endpoint (
/v3/api-docs) producing the following JSON except :{ "openapi": "3.0.1", "info": { ... }, "servers": [ ... ], "security": [ { "JWT token request": [] }, { "Api key (only for API Portal's swagger)": [] } ], "paths": { ... }, "components": { ..., "securitySchemes": { "Api key (only for API Portal's swagger)": { "type": "apiKey", "name": "X-Api-Key", "in": "header" }, "JWT token request": { "type": "oauth2", "flows": { "authorizationCode": { ....Unfortunately, the previous exerpt is the cause of a complain when it's loaded in Swagger UI Editor :
At my job, the team in charge of the API Management portal told me it's because of this error message that the Open API contract produced by my endpoint fails been loaded on the API Management portal's APIs catalog.
Of course, I could change my two parameters
OAUTH2_JWT_TOKEN_SECURITY_SCHEMEandAPI_KEY_SECURITY_SCHEMEto have the whole thing conforming to our Swagger UI display tool requirements.But on the other hand, I'd like to keep the possibility to controle the way those credentials are labeled when they are displayed in the "Try it" popup window that request thoses credentials :
This way it will be more user friendly.
Is their a way to achieve this, and if not, is it possible to make an enhancement to have the produced Open API v3 json document meeting both of previous requirements ? :
Thanks in advance for your consideration about my request
Best regards