Search in sources :

Example 1 with GroupConfig

use of org.springdoc.core.SpringDocConfigProperties.GroupConfig in project springdoc-openapi by springdoc.

the class MultipleOpenApiResource method afterPropertiesSet.

@Override
public void afterPropertiesSet() {
    this.groupedOpenApiResources = groupedOpenApis.stream().collect(Collectors.toMap(GroupedOpenApi::getGroup, item -> {
        GroupConfig groupConfig = new GroupConfig(item.getGroup(), item.getPathsToMatch(), item.getPackagesToScan(), item.getPackagesToExclude(), item.getPathsToExclude(), item.getProducesToMatch(), item.getConsumesToMatch(), item.getHeadersToMatch());
        springDocConfigProperties.addGroupConfig(groupConfig);
        return buildWebMvcOpenApiResource(item);
    }));
}
Also used : GroupConfig(org.springdoc.core.SpringDocConfigProperties.GroupConfig) GroupedOpenApi(org.springdoc.core.GroupedOpenApi)

Example 2 with GroupConfig

use of org.springdoc.core.SpringDocConfigProperties.GroupConfig in project springdoc-openapi by springdoc.

the class MultipleOpenApiResource method afterPropertiesSet.

@Override
public void afterPropertiesSet() {
    this.groupedOpenApiResources = groupedOpenApis.stream().collect(Collectors.toMap(GroupedOpenApi::getGroup, item -> {
        GroupConfig groupConfig = new GroupConfig(item.getGroup(), item.getPathsToMatch(), item.getPackagesToScan(), item.getPackagesToExclude(), item.getPathsToExclude(), item.getProducesToMatch(), item.getConsumesToMatch(), item.getHeadersToMatch());
        springDocConfigProperties.addGroupConfig(groupConfig);
        return buildWebFluxOpenApiResource(item);
    }));
}
Also used : GroupConfig(org.springdoc.core.SpringDocConfigProperties.GroupConfig) GroupedOpenApi(org.springdoc.core.GroupedOpenApi)

Example 3 with GroupConfig

use of org.springdoc.core.SpringDocConfigProperties.GroupConfig in project springdoc-openapi by springdoc.

the class AbstractOpenApiResource method getConditionsToMatch.

/**
 * Gets conditions to match.
 *
 * @param conditionType the condition type
 * @param groupConfigs the group configs
 * @return the conditions to match
 */
private List<String> getConditionsToMatch(ConditionType conditionType, GroupConfig... groupConfigs) {
    List<String> conditionsToMatch = null;
    GroupConfig groupConfig = null;
    if (ArrayUtils.isNotEmpty(groupConfigs))
        groupConfig = groupConfigs[0];
    switch(conditionType) {
        case HEADERS:
            conditionsToMatch = (groupConfig != null) ? groupConfig.getHeadersToMatch() : springDocConfigProperties.getHeadersToMatch();
            break;
        case PRODUCES:
            conditionsToMatch = (groupConfig != null) ? groupConfig.getProducesToMatch() : springDocConfigProperties.getProducesToMatch();
            break;
        case CONSUMES:
            conditionsToMatch = (groupConfig != null) ? groupConfig.getConsumesToMatch() : springDocConfigProperties.getConsumesToMatch();
            break;
        default:
            break;
    }
    return conditionsToMatch;
}
Also used : GroupConfig(org.springdoc.core.SpringDocConfigProperties.GroupConfig)

Aggregations

GroupConfig (org.springdoc.core.SpringDocConfigProperties.GroupConfig)3 GroupedOpenApi (org.springdoc.core.GroupedOpenApi)2