Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

After upgrading to 4.6.1, Generated client library for java is using "none" instead of "com". #172

Closed

Description

@zonito
╰─$ 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
OpenAPI spec written to ./fanv1openapi.json
Archive:  fan-v1.zip
   creating: fan/
   creating: fan/src/
   creating: fan/src/main/
   creating: fan/src/main/java/
   creating: fan/src/main/java/none/
   creating: fan/src/main/java/none/fan/
 extracting: fan/src/main/java/none/fan/FanScopes.java  
 extracting: fan/src/main/java/none/fan/FanRequest.java  
 extracting: fan/src/main/java/none/fan/Fan.java  
   creating: fan/src/main/java/none/fan/model/
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/model/somefile.java  
 extracting: fan/src/main/java/none/fan/FanRequestInitializer.java  
 extracting: fan/readme.html     
 extracting: fan/build.gradle    
 extracting: fan/LICENSE.txt     
 extracting: fan/proguard-google-api-client.txt 
@endpoints.api(name='fan', version='v1',
               description='API',
               title='Fan API',
               auth=_AUTH_CONFIG,
               owner_domain='fan.com')
class AuthApi(remote.Service):

Activity

  1. inklesspen commented on Sep 4, 2018

    @inklesspen
    Contributor

    What version are you upgrading from, please?

  2. self-assigned this
    on Sep 4, 2018
  3. inklesspen commented on Sep 4, 2018

    @inklesspen
    Contributor

    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.)

  4. zonito commented on Sep 4, 2018

    @zonito
    Author

    I have upgraded to 4.6.1

  5. zonito commented on Sep 4, 2018

    @zonito
    Author

    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.

  6. zonito commented on Sep 4, 2018

    @zonito
    Author

    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
    
  7. inklesspen commented on Sep 5, 2018

    @inklesspen
    Contributor

    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.

  8. zonito commented on Sep 5, 2018

    @zonito
    Author

    Came from 2.5.0 to 4.6.1

    --hostname=com.fan will do?

  9. inklesspen commented on Sep 5, 2018

    @inklesspen
    Contributor

    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.

  10. zonito commented on Sep 5, 2018

    @zonito
    Author

    --hostname works! 👍

  11. zonito commented on Sep 5, 2018

    @zonito
    Author

    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?

  12. inklesspen commented on Sep 5, 2018

    @inklesspen
    Contributor

    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.

  13. zonito commented on Sep 5, 2018

    @zonito
    Author

    Thanks

  14. inklesspen commented on Nov 16, 2018

    @inklesspen
    Contributor

    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.

  15. inklesspen commented on Nov 16, 2018

    @inklesspen
    Contributor

    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.

    if merged_api_info.namespace:
    descriptor['ownerDomain'] = merged_api_info.namespace.owner_domain
    descriptor['ownerName'] = merged_api_info.namespace.owner_name
    descriptor['packagePath'] = merged_api_info.namespace.package_path or ''
    should be extended to use the non-namespace values.

  16. inklesspen commented on Nov 20, 2018

    @inklesspen
    Contributor

    A new version with this fix will be released after the Thanksgiving holiday.

  17. inklesspen commented on Nov 27, 2018

    @inklesspen
    Contributor

    Frameworks version 4.8.0 has been released, which includes a fix for this issue.

  18. zonito commented on Dec 11, 2018

    @zonito
    Author

    Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions