How to expose graphql field with different name

后端 未结 4 1499
攒了一身酷
攒了一身酷 2020-12-18 18:33

I am exploring GraphQL and would like to know if there is any way of renaming the response field for example i have a POJO with these field

class POJO {
  Lo         


        
4条回答
  •  佛祖请我去吃肉
    2020-12-18 18:48

    Looks like GraphQLName annotation can help.

    Example from documentation : "Additionally, @GraphQLName can be used to override field name. You can use @GraphQLDescription to set a description."

    These can also be used for field parameters:

    public String field(@GraphQLName("val") String value) {
      return value;
    }
    

提交回复
热议问题