Skip to content

Commit

Permalink
Remove webjars-locator-core #2173
Browse files Browse the repository at this point in the history
  • Loading branch information
bnasslahsen committed Mar 28, 2023
1 parent c53c5bf commit bcaa257
Show file tree
Hide file tree
Showing 31 changed files with 257 additions and 509 deletions.
22 changes: 0 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
<nexus-staging-maven-plugin>1.6.8</nexus-staging-maven-plugin>
<swagger-api.version>2.2.9</swagger-api.version>
<swagger-ui.version>4.18.1</swagger-ui.version>
<classgraph.version>4.8.149</classgraph.version>
<webjars-locator-core.version>0.52</webjars-locator-core.version>
<gmavenplus-plugin.version>1.13.1</gmavenplus-plugin.version>
<jaxb-impl.version>2.1</jaxb-impl.version>
<javax.jws-api.version>1.1</javax.jws-api.version>
Expand All @@ -88,26 +86,6 @@
<artifactId>swagger-ui</artifactId>
<version>${swagger-ui.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
<version>${webjars-locator-core.version}</version>
<exclusions>
<exclusion>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>${classgraph.version}</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxb-impl</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions springdoc-openapi-starter-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@
<artifactId>querydsl-core</artifactId>
<optional>true</optional>
</dependency>
<!-- classgraph -->
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
* @author bnasslahsen
*/
@Lazy(false)
@ConditionalOnExpression("${springdoc.api-docs.enabled:true} and ${springdoc.enable-native-support:false}")
@ConditionalOnExpression("${springdoc.api-docs.enabled:true}")
@ConditionalOnWebApplication
@Configuration(proxyBeanMethods = false)
@ConditionalOnBean(SpringDocConfiguration.class)
public class SpringDocNativeConfiguration implements InitializingBean {
public class SpringDocUIConfiguration implements InitializingBean {

/**
* The constant SPRINGDOC_CONFIG_PROPERTIES.
Expand All @@ -73,7 +73,7 @@ public class SpringDocNativeConfiguration implements InitializingBean {
*
* @param optionalSwaggerUiConfigProperties the swagger ui config properties
*/
public SpringDocNativeConfiguration(Optional<SwaggerUiConfigProperties> optionalSwaggerUiConfigProperties) {
public SpringDocUIConfiguration(Optional<SwaggerUiConfigProperties> optionalSwaggerUiConfigProperties) {
this.optionalSwaggerUiConfigProperties = optionalSwaggerUiConfigProperties;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import io.swagger.v3.oas.models.security.Scopes;
import io.swagger.v3.oas.models.servers.ServerVariables;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.springdoc.core.configuration.SpringDocNativeConfiguration;
import org.springdoc.core.configuration.SpringDocUIConfiguration;
import org.springdoc.core.properties.SpringDocConfigProperties.ModelConverters;

import org.springframework.aot.hint.MemberCategory;
Expand Down Expand Up @@ -185,7 +185,7 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
//springdoc
hints.reflection().registerField(FieldUtils.getDeclaredField(io.swagger.v3.core.converter.ModelConverters.class, "converters", true));
hints.reflection().registerType(org.springdoc.core.utils.Constants.class, hint -> hint.withMembers(MemberCategory.DECLARED_FIELDS));
hints.resources().registerPattern(SpringDocNativeConfiguration.SPRINGDOC_CONFIG_PROPERTIES)
hints.resources().registerPattern(SpringDocUIConfiguration.SPRINGDOC_CONFIG_PROPERTIES)
.registerResourceBundle("sun.util.resources.LocaleNames");
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ public class SpringDocConfigProperties {
*/
private boolean enableKotlin = true;

/**
* The Enable native support.
*/
private boolean enableNativeSupport = false;

/**
* The Enable hateoas.
*/
Expand Down Expand Up @@ -373,25 +368,6 @@ public void setEnableHateoas(boolean enableHateoas) {
this.enableHateoas = enableHateoas;
}

/**
* Is enable native support boolean.
*
* @return the boolean
*/
public boolean isEnableNativeSupport() {
return enableNativeSupport;
}

/**
* Sets enable native support.
*
* @param enableNativeSupport the enable native support
*/
public void setEnableNativeSupport(boolean enableNativeSupport) {
this.enableNativeSupport = enableNativeSupport;
}


/**
* Is enable kotlin boolean.
*
Expand Down
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.UriComponentsBuilder;

import static org.springdoc.core.utils.Constants.INDEX_PAGE;
import static org.springdoc.core.utils.Constants.OAUTH_REDIRECT_PAGE;
import static org.springdoc.core.utils.Constants.SWAGGER_UI_OAUTH_REDIRECT_URL;
import static org.springdoc.core.utils.Constants.SWAGGER_UI_PREFIX;
import static org.springdoc.core.utils.Constants.SWAGGER_UI_URL;
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;


/**
* The type Abstract swagger welcome.
*
* @author bnasslashen
*/
public abstract class AbstractSwaggerWelcome {
Expand Down Expand Up @@ -224,12 +222,7 @@ protected void calculateUiRootCommon(StringBuilder sbUrl, StringBuilder[] sbUrls
* @return the oauth2 redirect url
*/
protected String getOauth2RedirectUrl() {
if (StringUtils.isNotEmpty(swaggerUiConfig.getVersion())) {
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_PREFIX + DEFAULT_PATH_SEPARATOR + swaggerUiConfig.getVersion() + OAUTH_REDIRECT_PAGE);
}
else {
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_OAUTH_REDIRECT_URL);
}
return StringUtils.defaultIfBlank(swaggerUiConfig.getOauth2RedirectUrl(), SWAGGER_UI_OAUTH_REDIRECT_URL);
}

/**
Expand All @@ -238,9 +231,6 @@ protected String getOauth2RedirectUrl() {
* @return the swagger ui url
*/
protected String getSwaggerUiUrl() {
if (StringUtils.isNotEmpty(swaggerUiConfig.getVersion()))
return SWAGGER_UI_PREFIX + DEFAULT_PATH_SEPARATOR + swaggerUiConfig.getVersion() + INDEX_PAGE;
else
return SWAGGER_UI_URL;
return SWAGGER_UI_URL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ org.springdoc.core.configuration.SpringDocJavadocConfiguration
org.springdoc.core.configuration.SpringDocGroovyConfiguration
org.springdoc.core.configuration.SpringDocSecurityConfiguration
org.springdoc.core.configuration.SpringDocFunctionCatalogConfiguration
org.springdoc.core.configuration.SpringDocNativeConfiguration
org.springdoc.core.configuration.SpringDocHateoasConfiguration
org.springdoc.core.configuration.SpringDocPageableConfiguration
org.springdoc.core.configuration.SpringDocSortConfiguration
Expand Down
8 changes: 0 additions & 8 deletions springdoc-openapi-starter-webflux-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</dependency>
<!-- Actuator dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,16 @@ SwaggerUiHome swaggerUiHome(Optional<WebFluxProperties> optionalWebFluxPropertie
* @param springDocConfigProperties the spring doc config properties
* @param swaggerIndexTransformer the swagger index transformer
* @param actuatorProvider the actuator provider
* @param swaggerResourceResolver the swagger resource resolver
* @return the swagger web flux configurer
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
SwaggerWebFluxConfigurer swaggerWebFluxConfigurer(SwaggerUiConfigParameters swaggerUiConfigParameters, SpringDocConfigProperties springDocConfigProperties, SwaggerIndexTransformer swaggerIndexTransformer, Optional<ActuatorProvider> actuatorProvider) {
return new SwaggerWebFluxConfigurer(swaggerUiConfigParameters, springDocConfigProperties, swaggerIndexTransformer, actuatorProvider);
SwaggerWebFluxConfigurer swaggerWebFluxConfigurer(SwaggerUiConfigParameters swaggerUiConfigParameters,
SpringDocConfigProperties springDocConfigProperties, SwaggerIndexTransformer swaggerIndexTransformer,
Optional<ActuatorProvider> actuatorProvider, SwaggerResourceResolver swaggerResourceResolver) {
return new SwaggerWebFluxConfigurer(swaggerUiConfigParameters, springDocConfigProperties, swaggerIndexTransformer, actuatorProvider, swaggerResourceResolver);
}

/**
Expand Down Expand Up @@ -173,6 +176,26 @@ SpringWebProvider springWebProvider() {
return new SpringWebFluxProvider();
}

/**
* Swagger resource resolver swagger resource resolver.
*
* @param swaggerUiConfigProperties the swagger ui config properties
* @return the swagger resource resolver
*/

/**
* Swagger resource resolver swagger resource resolver.
*
* @param swaggerUiConfigProperties the swagger ui config properties
* @return the swagger resource resolver
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
SwaggerResourceResolver swaggerResourceResolver(SwaggerUiConfigProperties swaggerUiConfigProperties) {
return new SwaggerResourceResolver(swaggerUiConfigProperties);
}

/**
* The type Swagger actuator welcome configuration.
* @author bnasslashen
Expand Down

0 comments on commit bcaa257

Please sign in to comment.