Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in parsing objects annotated with @RequestBody across different interfaces. #458

Closed
Gahon1995 opened this issue Mar 14, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Gahon1995
Copy link

Gahon1995 commented Mar 14, 2023

Your Environment(您的使用环境)

All are the latest versions.

Expected Behavior(您期望的结果)

The field names corresponding to openapi generated from different interfaces should be distinct.
不同接口生成的openapi对应的字段名应该不一样

Current Behavior(当前结果)

In multiple different interfaces, objects with the In multiple different interfaces, objects with the annotation that have only one type objects with the @RequestBody annotation that have only one type in common but differ in name are all parsed as the same type. For example, the field names generated for all interfaces become "userId".
多个不同接口下的RequestBody注解的不同对象里都只有一个类型相同但是名称不同的,都会被解析成同一个类型
, 比如所有接口生成的字段名都为userId

Possible Solution(bug解决建议)

Upon reviewing the OpenAPI interface documentation, the requests for different interfaces all point to a component named string in their refs.
查看openapi接口文档,不同接口的请求指向的refs都是同一个名为string的component

Steps to Reproduce (Bug产生步骤,请尽量提供用例代码)

For example, if the following three are used as parameters with the @ResponseBody annotation in different interfaces within various controllers, the generated OpenAPI might display the input parameters for all three interfaces as "userId".

public class UserDeleteRequest  {

    /**
     * 用户id
     */
    private Long userId;
}

public class RoleDeleteRequest  {

    /**
     * 角色id
     */
    private Long roleId;
}

public class MenuDeleteRequest  {

    /**
     * 菜单id
     */
    private Long menuId;
}

Context(Bug影响描述)

This results in errors in the generated OpenAPI interface, rendering it unusable.
导致生成的openapi接口错误,无法正常使用

@Gahon1995 Gahon1995 added the bug Something isn't working label Mar 14, 2023
@shalousun
Copy link
Collaborator

shalousun commented Mar 15, 2023

@Gahon1995 Please submit an issue following the issue template to facilitate problem tracking.

@Gahon1995
Copy link
Author

Gahon1995 commented Mar 16, 2023

@Gahon1995 Please submit an issue following the issue template to facilitate problem tracking.

The modifications are complete; please take a look when you have time.
修改好了,有时间看看

shalousun added a commit that referenced this issue Mar 27, 2023
@shalousun shalousun added this to the 2.6.7 milestone Mar 28, 2023
@shalousun shalousun changed the title 不同接口RequestBody注解的对象解析错误 Error in parsing objects annotated with @RequestBody across different interfaces. Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants