cloudendpoints / endpoints-java

A Java framework for building RESTful APIs on Google App Engine
Apache License 2.0
32 stars 35 forks source link

"gcloud service-management deploy..." not compatible with endpoints-framework-gradle-plugin generated openapi.json file #119

Closed Aardvarklord closed 6 years ago

Aardvarklord commented 6 years ago

Steps to reproduce:

  1. Create an endpoints API that uses firebase authentication and also add apiKeyRequired = AnnotationBoolean.TRUE to the API
  2. Use the endpoints-framework-gradle-plugin to generate the openapi.json file
  3. Deploy the API by running gcloud service-management deploy .\build\endpointsOpenApiDocs\openapi.json

Warnings like this are shown: WARNING: openapi.json: Operation 'put' in path 'XXXXXXXXX': Operation does not require an API key; callers may invoke the method without specifying an associated API-consuming project. To enable API key all the SecurityRequirement Objects (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-requirement-object) inside security definition must reference at least one SecurityDefinition of type : 'apiKey'.

The openapi.json file generated by the plugin contains this:

"security": [
     {
      "firebase": [ ]
     },
     {
      "api_key": [ ]
     }
    ],

If I edit the openapi.json file to this the warnings disappear:


"security": [
     {
      "firebase": [ ],
      "api_key": [ ]
     }
    ],
tangiel commented 6 years ago

Fixed by #118.

AdamSantosCA commented 6 years ago

This fix resolved my issue once I modified endpoints-framework-maven-plugin to use the fixed version of endpoints-framework. Thanks!