Generated discovery file for iOS endpoints fails

2019-04-09 13:12发布

I'm hoping some one can help me out here, maybe give me an idea of what to look for. When I run the service generator on my discovery file I get the following output:

Generation Settings:
Output Directory: ~/Desktop/endpoints

Discovery RPC URL: https://www.googleapis.com/rpc?prettyPrint=false
Api Log Dir: ~/Desktop/endpoints
Flags:

  • Use service name directory: NO
  • Remove unknown files: NO
  • Add 'Generated' directory: NO
  • Allow rootURL overrides: YES Loading API File(s):
  • Fetching ~/Desktop/myendpoint-v1-rest.discovery ERROR: The api description doesn't appear to be a discovery rpc description Generating: Writing:
  • No changes from what is already on disk.

I tried running it both with the verbose flag and by giving it a directory to write logs in and neither gives me anymore information. I generated the endpoint using eclipse and the API works in the API explorer.

3条回答
啃猪蹄的小仙女
2楼-- · 2019-04-09 13:39

Turns out I failed to notice that eclipse generated rest instead of rpc discovery files. You can find a work around here. Thanks @PaulR

查看更多
贪生不怕死
3楼-- · 2019-04-09 13:39

This probably doesn't apply to most people, but if you are using Android Studio and use gradle on the backend module, the discovery docs can be automatically generated by setting getClientLibsOnBuild = true in the module's gradle file:

appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
}

The discovery docs are located in <project>/<module>/build/discovery-docs/. If they aren't generated, try deploying to App Engine, that did it for me.

查看更多
贪生不怕死
4楼-- · 2019-04-09 13:49

ServiceGenerator needs a discovery file in rpc format instead of rest format. You can specify the format with the argument -f rpc

An example:

{your_path_to_appengine_sdk}/endpoints.sh get-discovery-doc -f rpc your.package.yourAPIclass

查看更多
登录 后发表回答