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

关于 @JsonUnwrapped 脚本无法支持去除包装类 #998

Closed
LawlietNot opened this issue Jul 4, 2023 · 1 comment · Fixed by #999
Closed

关于 @JsonUnwrapped 脚本无法支持去除包装类 #998

LawlietNot opened this issue Jul 4, 2023 · 1 comment · Fixed by #999
Labels
type: bug Something isn't working

Comments

@LawlietNot
Copy link

LawlietNot commented Jul 4, 2023

https://github.com/tangcent/easy-yapi/blame/f87fb82a4129bffb7a6ead88c53a2285ba5483ef/idea-plugin/src/main/resources/.recommend.easy.api.config#L64-L65

这个注解的含义是去除标识字段包装类,但这个配置实际只能支持增加前后缀
请问有什么方法可以改变 json 的解析可以支持把包装的字段去除 ?

Annotation used to indicate that a property should be serialized "unwrapped"; that is, if it would be serialized as JSON Object, its properties are instead included as properties of its containing Object. For example, consider case of POJO like:
   public class Parent {
     public int age;
     public Name name;
   }
   public class Name {
     public String first, last;
   }
 
which would normally be serialized as follows (assuming @JsonUnwrapped had no effect):
   {
     "age" : 18,
     "name" : {
       "first" : "Joey",
       "last" : "Sixpack"
     }
   }
 
can be changed to this:
   {
     "age" : 18,
     "first" : "Joey",
     "last" : "Sixpack"
   }
 
by changing Parent class to:
   public class Parent {
     public int age;
     @JsonUnwrapped
     public Name name;
   }
 
@LawlietNot LawlietNot changed the title 关于 @JsonUnwrapped 脚本无法支持提出包装类 关于 @JsonUnwrapped 脚本无法支持去除包装类 Jul 4, 2023
@tangcent tangcent added type: bug Something isn't working status: work-in-progress Currently being worked on labels Jul 4, 2023
@tangcent
Copy link
Owner

tangcent commented Jul 4, 2023

抱歉,这是个bug。
你可以试试手动更新插件: easy-yapi-2.5.9.212.0.zip
也可以手动加入配置:
[email protected]

@tangcent tangcent added status: wait-for-release Awaiting release for further action and removed status: work-in-progress Currently being worked on labels Jul 4, 2023
@tangcent tangcent removed the status: wait-for-release Awaiting release for further action label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants