My goal is to set up a simple API for uploading a file via Google Endpoints.
This is my simplified OpenAPI specification which is valid according to Swagger validation:
swagger: "2.0" info: title: "JSON Ingester" description: "Receive JSON files, transform and load them." version: "1.0.0" host: "project-id.appspot.com" schemes: - "https" paths: /uploadFile: post: operationId: uploadFile consumes: - multipart/form-data parameters: - in: formData name: upfile type: file description: file responses: 200: description: "File uploaded." 400: description: "Error during file upload."
Here comes the dummy Flask controller for the upload (though, I guess it is irrelevant to the problem):
@app.route('/uploadFile', methods=['POST']) def uploadFile(): return
I always end up with this obscure error message:
user@cloudshell:~/google-cloud-json-ingester (project-id)$ gcloud endpoints services deploy ./openapi.yaml ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot convert to service config. 'location: "openapi.yaml: Operation \'post\' in path \'/uploadFile\'" message: "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://gi thub.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\'." location: "unknown location" kind: ERROR message: "http: repeated message field \'google.protobuf.Struct.fields\' referred to by message \'UploadFileRequest\' cannot be mapped as an HTTP parameter." location: "unknown location" kind: ERROR message: "http: cyclic message field \'google.protobuf.Struct.FieldsEntry.value\' referred to by message \'UploadFileRequest\' in method \'method 1.project_id_appspot_com.UploadFile\' cannot be mapped as an HTTP parameter." location: "unknown location" kind: ERROR message: "http: cyclic message field \'google.protobuf.ListValue.values\' referred to by message \'UploadFileRequest\' in method \'method 1.project_id_appspot_com.UploadFile\' cannot be mapp ed as an HTTP parameter." '
I've run out of ideas as to what might be the cause.