Skip to content

Commit c5e09d8

Browse files
Add support for swagger-ui.url property
1 parent 3c34e5f commit c5e09d8

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/ui/AbstractSwaggerIndexTransformer.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ protected String overwriteSwaggerDefaultUrl(String html) {
135135
return html.replace(Constants.SWAGGER_UI_DEFAULT_URL, StringUtils.EMPTY);
136136
}
137137

138+
/**
139+
* Setting the url configured with swagger ui properties
140+
*
141+
* @param html
142+
* @return modifed html
143+
*/
144+
protected String setConfiguredApiDocsUrl(String html){
145+
return html.replace(Constants.SWAGGER_UI_DEFAULT_URL, swaggerUiConfig.getUrl());
146+
}
147+
138148
/**
139149
* Default transformations string.
140150
*
@@ -167,6 +177,10 @@ else if (swaggerUiConfig.getCsrf().isUseSessionStorage())
167177
if (swaggerUiConfig.isDisableSwaggerDefaultUrl())
168178
html = overwriteSwaggerDefaultUrl(html);
169179

180+
if(StringUtils.isNotEmpty(swaggerUiConfig.getUrl())){
181+
html = setConfiguredApiDocsUrl(html);
182+
}
183+
170184
return html;
171185
}
172186

0 commit comments

Comments
 (0)