Closed zonito closed 5 years ago
What version are you upgrading from, please?
Also, if possible, please share the discovery doc generated with endpointscfg.py gen_discovery_doc
. (This discovery doc is what's used to generate the Java client; inspecting it may help me find where the problem lies.)
I have upgraded to 4.6.1
Discovery content
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/userinfo.email": {
"description": "View your email address"
}
}
}
},
"basePath": "/_ah/api/fan/v1/",
"baseUrl": "https://None/_ah/api/fan/v1/",
"batchPath": "batch",
"description": "API",
"discoveryVersion": "v1",
Baseurl is also showing None.
I am using gcloud
to deploy application so in my app.yaml the "application
" and "version
" is commented.
Earlier, it was using owner_domain
to create package.
With application
and version
, here is the list of files generated which is different from old versions (it was using owner_domain
):
╰─$ sh generate_api.sh
INFO:endpoints:Initializing Endpoints Framework version 4.6.1
API client library written to ../PGAPIs/PGAndAPI/fan-v1.zip
INFO:endpoints:Initializing Endpoints Framework version 4.6.1
API discovery document written to ./fan-v1.discovery
Archive: fan-v1.zip
creating: fan/
creating: fan/src/
creating: fan/src/main/
creating: fan/src/main/java/
creating: fan/src/main/java/com/
creating: fan/src/main/java/com/appspot/
creating: fan/src/main/java/com/appspot/fan_api_pg/
creating: fan/src/main/java/com/appspot/fan_api_pg/fan/
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/fanScopes.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/fanRequest.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/fan.java
creating: fan/src/main/java/com/appspot/fan_api_pg/fan/model/
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsBlockInfoResponse.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsBlockListResponse.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsBlockModel.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsCreateTeamRequest.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsCreateTeamResponse.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsLeaderboardTeams.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsPlayerModel.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsStatusResponse.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsTeamModel.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/model/ApiStructsApiModelsWinnerFormatModel.java
extracting: fan/src/main/java/com/appspot/fan_api_pg/fan/fanRequestInitializer.java
extracting: fan/readme.html
extracting: fan/build.gradle
extracting: fan/LICENSE.txt
extracting: fan/proguard-google-api-client.txt
total 4400
Yes, but what version did you upgrade from? What's the last version at which it works?
Note that generating discovery docs and clients also requires specifying the hostname, either in the api decorator or on the command line, or in the app.yaml (in that case by using the application specified in the app.yaml). In your second example, it is generating a hostname based on the app.yaml file.
Please make sure that your generate_api.sh script is properly setting a hostname when calling these commands.
Came from 2.5.0
to 4.6.1
--hostname=com.fan
will do?
That's quite a version jump... But I'll look into it.
And no, when you specify the hostname, you must specify the actual domain name at which your api will be served. If you're using a custom domain, that could be fan.com
, but it can't be com.fan
.
--hostname
works! 👍
Yes, that's the issue. It creates the package with it and the endpoint as well. For now, I can the domain manually inside the Fan.Java, is there any automated way to update both?
Nothing changed regarding the handling of owner_domain between 2.5.0 and 4.6.1. However, what did change was that the framework no longer calls an external service to generate discovery docs. (It does still call an external service to generate the Java client files.)
I will investigate whether the external service treated owner_domain differently.
Thanks
4.6.1 generates discovery docs that are missing the 'etag' and 'ownerDomain' keys. Neither of those keys is documented at https://developers.google.com/discovery/v1/reference/apis but at least the 'ownerDomain' key seems to be important.
Turns out there's actually two ways to specify the owner domain. One way is with owner_domain='example.com'
; the other is with namespace=endpoints.Namespace(owner_domain='example.com', owner_name='Example')
.
The discovery document generation which fed into the Java client generation used to use the first value; now it uses the second value. The problem is this second value is nowhere documented.
https://github.com/cloudendpoints/endpoints-python/blob/efd350c07e742ed34c98c9edb3b35f113d6f7e92/endpoints/discovery_generator.py#L880-L883 should be extended to use the non-namespace values.
A new version with this fix will be released after the Thanksgiving holiday.
Frameworks version 4.8.0 has been released, which includes a fix for this issue.
Thanks