You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using AdditionalModelsConverter we've faced with a problem that many BigDecimal fields wrongly marked as deprecated in swagger json.
We return BigDecimal as String in json {"val": "12.34"} and use configuration: SpringDocUtils.getConfig().replaceWithSchema(BigDecimal.class, new Schema<BigDecimal>().type("string").format("decimal"));
@RestController("/")
public class HelloController {
public record Response(@Schema(deprecated = true) @Deprecated BigDecimal val1,
BigDecimal val2, // also marked as deprecated in swagger json
BigDecimal val3 // also marked as deprecated in swagger json
) {}
@GetMapping
public Response test() {
return new Response(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ONE);
}
}
And the main class:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringDocUtils.getConfig().replaceWithSchema(
BigDecimal.class,
new Schema<BigDecimal>().type("string").format("decimal")
);
SpringApplication.run(Application.class, args);
}
}
Hi,
While using AdditionalModelsConverter we've faced with a problem that many BigDecimal fields wrongly marked as deprecated in swagger json.
We return BigDecimal as String in json
{"val": "12.34"}
and use configuration:SpringDocUtils.getConfig().replaceWithSchema(BigDecimal.class, new Schema<BigDecimal>().type("string").format("decimal"));
It seems that the problem is in AdditionalModelsConverter resolve method:
https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-common/src/main/java/org/springdoc/core/converters/AdditionalModelsConverter.java#L134
It returns the object from modelToSchemaMap instead of clone of this object. In SchemaPropertyDeprecatingConverter resolve method this object marked as deprecated.
https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-common/src/main/java/org/springdoc/core/converters/SchemaPropertyDeprecatingConverter.java#L92
After that we have deprecated object in modelToSchemaMap.
The text was updated successfully, but these errors were encountered: