-
-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c53c5bf
commit bcaa257
Showing
31 changed files
with
257 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...starter-common/src/main/java/org/springdoc/core/configuration/hints/SpringDocUiHints.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...penapi-starter-common/src/main/java/org/springdoc/ui/AbstractSwaggerResourceResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.springdoc.ui; | ||
|
||
import java.io.File; | ||
|
||
|
||
import org.springdoc.core.properties.SwaggerUiConfigProperties; | ||
|
||
import org.springframework.lang.Nullable; | ||
|
||
/** | ||
* The type Web jars version resource resolver. | ||
* | ||
* @author bnasslahsen | ||
*/ | ||
public class AbstractSwaggerResourceResolver { | ||
|
||
/** | ||
* The Swagger ui config properties. | ||
*/ | ||
private final SwaggerUiConfigProperties swaggerUiConfigProperties; | ||
|
||
/** | ||
* Instantiates a new Web jars version resource resolver. | ||
* | ||
* @param swaggerUiConfigProperties the swagger ui config properties | ||
*/ | ||
public AbstractSwaggerResourceResolver(SwaggerUiConfigProperties swaggerUiConfigProperties) { | ||
this.swaggerUiConfigProperties = swaggerUiConfigProperties; | ||
} | ||
|
||
/** | ||
* Find web jar resource path string. | ||
* | ||
* @param path the path | ||
* @return the string | ||
*/ | ||
@Nullable | ||
protected String findWebJarResourcePath(String path) { | ||
String webjar = webjar(path); | ||
if (webjar.length() > 0) { | ||
String version = swaggerUiConfigProperties.getVersion(); | ||
if (version != null) { | ||
String partialPath = path(webjar, path); | ||
return webjar + File.separator + version + File.separator + partialPath; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Webjar string. | ||
* | ||
* @param path the path | ||
* @return the string | ||
*/ | ||
private String webjar(String path) { | ||
int startOffset = (path.startsWith("/") ? 1 : 0); | ||
int endOffset = path.indexOf('/', 1); | ||
return endOffset != -1 ? path.substring(startOffset, endOffset) : path; | ||
} | ||
|
||
|
||
/** | ||
* Path string. | ||
* | ||
* @param webjar the webjar | ||
* @param path the path | ||
* @return the string | ||
*/ | ||
private String path(String webjar, String path) { | ||
if (path.startsWith(webjar)) { | ||
path = path.substring(webjar.length() + 1); | ||
} | ||
return path; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.