Search in sources :

Example 1 with Builder

use of org.springdoc.core.GroupedOpenApi.Builder in project jhipster-bom by jhipster.

the class JHipsterSpringDocGroupsConfiguration method openAPIDefaultGroupedOpenAPI.

/**
 * OpenApi default group configuration.
 *
 * @return the GroupedOpenApi configuration
 */
@Bean
@ConditionalOnMissingBean(name = "openAPIDefaultGroupedOpenAPI")
public GroupedOpenApi openAPIDefaultGroupedOpenAPI(List<OpenApiCustomiser> openApiCustomisers, List<OperationCustomizer> operationCustomizers, @Qualifier("apiFirstGroupedOpenAPI") Optional<GroupedOpenApi> apiFirstGroupedOpenAPI, SpringDocConfigProperties springDocConfigProperties) {
    log.debug("Initializing JHipster OpenApi default group");
    Builder builder = GroupedOpenApi.builder().group(DEFAULT_GROUP_NAME).pathsToMatch(properties.getDefaultIncludePattern());
    openApiCustomisers.stream().filter(customiser -> !(customiser instanceof ActuatorOpenApiCustomizer)).forEach(builder::addOpenApiCustomiser);
    operationCustomizers.stream().filter(customiser -> !(customiser instanceof ActuatorOperationCustomizer)).forEach(builder::addOperationCustomizer);
    apiFirstGroupedOpenAPI.ifPresent(apiFirst -> {
        if (apiFirst.getPackagesToScan() != null) {
            apiFirst.getPackagesToScan().stream().forEach(builder::packagesToExclude);
        }
    });
    return builder.build();
}
Also used : ActuatorOpenApiCustomizer(org.springdoc.core.customizers.ActuatorOpenApiCustomizer) OperationCustomizer(org.springdoc.core.customizers.OperationCustomizer) Builder(org.springdoc.core.GroupedOpenApi.Builder) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) JHipsterOpenApiCustomizer(tech.jhipster.config.apidoc.customizer.JHipsterOpenApiCustomizer) LoggerFactory(org.slf4j.LoggerFactory) StringUtils(org.apache.commons.lang3.StringUtils) ByteBuffer(java.nio.ByteBuffer) Value(org.springframework.beans.factory.annotation.Value) JHipsterProperties(tech.jhipster.config.JHipsterProperties) DEFAULT_GROUP_NAME(org.springdoc.core.Constants.DEFAULT_GROUP_NAME) Qualifier(org.springframework.beans.factory.annotation.Qualifier) SpringDocUtils.getConfig(org.springdoc.core.SpringDocUtils.getConfig) OpenApiCustomiser(org.springdoc.core.customizers.OpenApiCustomiser) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty) SpringDocConfigProperties(org.springdoc.core.SpringDocConfigProperties) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Logger(org.slf4j.Logger) GroupedOpenApi(org.springdoc.core.GroupedOpenApi) Info(io.swagger.v3.oas.models.info.Info) Configuration(org.springframework.context.annotation.Configuration) SPRINGDOC_SHOW_ACTUATOR(org.springdoc.core.Constants.SPRINGDOC_SHOW_ACTUATOR) List(java.util.List) Optional(java.util.Optional) Bean(org.springframework.context.annotation.Bean) ActuatorOperationCustomizer(org.springdoc.core.customizers.ActuatorOperationCustomizer) ActuatorOpenApiCustomizer(org.springdoc.core.customizers.ActuatorOpenApiCustomizer) Builder(org.springdoc.core.GroupedOpenApi.Builder) ActuatorOperationCustomizer(org.springdoc.core.customizers.ActuatorOperationCustomizer) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Info (io.swagger.v3.oas.models.info.Info)1 ByteBuffer (java.nio.ByteBuffer)1 List (java.util.List)1 Optional (java.util.Optional)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 DEFAULT_GROUP_NAME (org.springdoc.core.Constants.DEFAULT_GROUP_NAME)1 SPRINGDOC_SHOW_ACTUATOR (org.springdoc.core.Constants.SPRINGDOC_SHOW_ACTUATOR)1 GroupedOpenApi (org.springdoc.core.GroupedOpenApi)1 Builder (org.springdoc.core.GroupedOpenApi.Builder)1 SpringDocConfigProperties (org.springdoc.core.SpringDocConfigProperties)1 SpringDocUtils.getConfig (org.springdoc.core.SpringDocUtils.getConfig)1 ActuatorOpenApiCustomizer (org.springdoc.core.customizers.ActuatorOpenApiCustomizer)1 ActuatorOperationCustomizer (org.springdoc.core.customizers.ActuatorOperationCustomizer)1 OpenApiCustomiser (org.springdoc.core.customizers.OpenApiCustomiser)1 OperationCustomizer (org.springdoc.core.customizers.OperationCustomizer)1 Qualifier (org.springframework.beans.factory.annotation.Qualifier)1 Value (org.springframework.beans.factory.annotation.Value)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1