Skip to content

If two diff model class has same value for "@JsonRootName" annotation,if i am using these two model for req and resp of any api method then ,It overriding the one class to another randomly and as a result showing the same example value for req and resp. #3286

@yashodhan1211

Description

@yashodhan1211

I have just encountered this behaviour and was really suprised because I would assume that this would be a serious issue. For example I have one User model and have multiple request and response classes for multiple operations with User - each containing only a subset of User's attributes.

For example I have class CreateUserRequest (in one package) annotated with @JsonRootName(value = "user") and another class UpdateUsersStateRequest (may be even in the same package) again with annotation @JsonRootName(value = "user"). Swagger definition has only one of those definitions and ignoring others so basically most of the generated examples which I see in swagger UI are wrong.

I would assume that swagger would have different definition for each REST method, am I missing something? It is extremely important to be able to define same object with different attributes in different API methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions