Skip to content

AdditionalModelsConverter Schema params rewriting #1957

Closed
@apervushin

Description

@apervushin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions