Google clould endpoint Api method generated without the required parameter

风格不统一 提交于 2020-01-06 19:53:11

问题


I want to deploy v2 of my google endpoint API. in this version 2, i have added an ApiMethod with a parameter

 /**
 * An endpoint class we are exposing
 */
@Api(
  name = "myApi",
  version = "v2",
  namespace = @ApiNamespace(
    ownerDomain = "awesome.me.com",
    ownerName = "awesome.me.com",
    packagePath = "api/v2"
  )
)
public class MyEndpointV2 extends MyEndpoint{


  @ApiMethod(name = "getContact")
  public Charges getContact(ContactRequest request){
    return ContactHandler.getContact(request);
  }
}

As you can see, my V2 extends my V1 Api so i can access all my V1 methods. the issue is that,my new method is generated without parameter ContactRequest. that is when i try to call the method in my app module, it appears as follows

myapi.getContact()

What could be the problem? I have tried to clean build my project but nothing happens

EDIT Here's MyEndPoint class

 @Api(
      name = "myApi",
      version = "v1",
      namespace = @ApiNamespace(
        ownerDomain = "awesome.me.com",
        ownerName = "awesome.me.com",
        packagePath = ""
      )
    )
    public class MyEndpoint{


     @ApiMethod(name = "getPeriod")
  public Period getPeriod(@Named("days")long days) {
    return Handler.getPeriod(days);
  }
  //other api methods
    }

回答1:


This error may caused by your inheritance. Please read the following documentation

https://cloud.google.com/appengine/docs/java/endpoints/multiclass

It says that you have to use the same values for your annotations. You tried to override the values for Version and package. This can lead to undefined behaviour



来源:https://stackoverflow.com/questions/42371135/google-clould-endpoint-api-method-generated-without-the-required-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!