Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<central-publishing-maven-plugin.version>0.7.0
</central-publishing-maven-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<swagger-api.version>2.2.47</swagger-api.version>
<swagger-api.version>2.2.49</swagger-api.version>
<swagger-ui.version>5.32.2</swagger-ui.version>
<gmavenplus-plugin.version>1.13.1</gmavenplus-plugin.version>
<jjwt.version>0.9.1</jjwt.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,6 @@ protected OpenAPI getOpenApi(String serverBaseUrl, Locale locale) {
}
getPaths(mappingsMap, finalLocale, openAPI);

if (OpenApiVersion.OPENAPI_3_1 == springDocConfigProperties.getApiDocs().getVersion())
handleComponentSchemaTypes(openAPI);

if (springDocConfigProperties.isTrimKotlinIndent())
this.trimIndent(openAPI);

Expand Down Expand Up @@ -458,20 +455,6 @@ private void trimIndent(OpenAPI openAPI) {
trimPaths(openAPI);
}

/**
* Fix component schemas for OAS 3.1 post-processing.
*
* @param openAPI the open api
*/
private static void handleComponentSchemaTypes(OpenAPI openAPI) {
if (openAPI.getComponents() == null || openAPI.getComponents().getSchemas() == null) {
return;
}
for (Schema<?> schema : openAPI.getComponents().getSchemas().values()) {
SpringDocUtils.fixNullOnlyAdditionalProperties(schema);
}
}

/**
* Trim the indent for descriptions in the 'components' of open api.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Boolean hasRequiredMarker(AnnotatedMember annotatedMember) {
if (schemaAnnotation.required() || requiredMode == Schema.RequiredMode.REQUIRED) {
return true;
}
else if (requiredMode == Schema.RequiredMode.NOT_REQUIRED || (StringUtils.isNotEmpty(schemaAnnotation.defaultValue()) && !Schema.DEFAULT_SENTINEL.equals(schemaAnnotation.defaultValue()))) {
else if (requiredMode == Schema.RequiredMode.NOT_REQUIRED || StringUtils.isNotEmpty(schemaAnnotation.defaultValue())) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ public String[] allowableValues() {

@Override
public String defaultValue() {
String defaultValue = getDefaultValue(parameterName, pageableDefault, parameterSchema.defaultValue());
return defaultValue != null ? defaultValue : io.swagger.v3.oas.annotations.media.Schema.DEFAULT_SENTINEL;
return getDefaultValue(parameterName, pageableDefault, parameterSchema.defaultValue());
}

@Override
Expand Down Expand Up @@ -758,8 +757,7 @@ public String[] allowableValues() {

@Override
public String defaultValue() {
String defaultValue = getArrayDefaultValue(parameterName, pageableDefault, sortDefault, schema.defaultValue());
return defaultValue != null ? defaultValue : io.swagger.v3.oas.annotations.media.Schema.DEFAULT_SENTINEL;
return getArrayDefaultValue(parameterName, pageableDefault, sortDefault, schema.defaultValue());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public class Builder {
/**
* Provides a default value.
*/
private String defaultValue = Schema.DEFAULT_SENTINEL;
private String defaultValue = "";

/**
* Provides a discriminator property value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.core.util.Yaml31;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.core.util.PrimitiveType;
import io.swagger.v3.oas.models.media.Schema;
import org.springdoc.core.mixins.SortedOpenAPIMixin;
import org.springdoc.core.mixins.SortedOpenAPIMixin31;
Expand Down Expand Up @@ -81,14 +80,10 @@ public ObjectMapperProvider(SpringDocConfigProperties springDocConfigProperties)
if (springDocConfigProperties.isExplicitObjectSchema()) {
System.setProperty(Schema.EXPLICIT_OBJECT_SCHEMA_PROPERTY, "true");
}
else {
PrimitiveType.explicitObjectType = false;
}
}
else {
jsonMapper = Json.mapper();
yamlMapper = Yaml.mapper();
PrimitiveType.explicitObjectType = null;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public static Object castDefaultValue(Schema schema, Object defaultValue) {
*/
public static Object resolveDefaultValue(String defaultValueStr, ObjectMapper objectMapper) {
Object defaultValue = null;
if (StringUtils.isNotEmpty(defaultValueStr) && !io.swagger.v3.oas.annotations.media.Schema.DEFAULT_SENTINEL.equals(defaultValueStr)) {
if (StringUtils.isNotEmpty(defaultValueStr)) {
try {
defaultValue = objectMapper.readTree(defaultValueStr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ else if (schema.getItems() != null && schema.getItems().getType() != null
/**
* Fix additionalProperties incorrectly set to {"type": "null"} when @Nullable
* propagates from a Map field to its Object value type (resolved as "any type" = {}).
* <p>
* Tracked under <a href="https://github.com/swagger-api/swagger-core/issues/5115">swagger-core#5115</a>.
*
* @param schema the schema to fix
*/
Expand Down
2 changes: 1 addition & 1 deletion springdoc-openapi-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springdoc-openapi-data-rest-tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-tests</artifactId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<artifactId>springdoc-openapi-groovy-tests</artifactId>
<name>${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springdoc-openapi-hateoas-tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-tests</artifactId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"schema": {
"type": "integer",
"format": "int32",
"exclusiveMinimum": 0
"exclusiveMinimum": 0,
"minimum": 0
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springdoc-openapi-kotlin-webflux-tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>springdoc-openapi-tests</artifactId>
<groupId>org.springdoc</groupId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>springdoc-openapi-kotlin-webmvc-tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-tests</artifactId>
<version>2.8.17-SNAPSHOT</version>
<version>2.8.18-SNAPSHOT</version>
</parent>
<artifactId>springdoc-openapi-security-tests</artifactId>
<name>${project.artifactId}</name>
Expand Down
Loading