2

The problem

I am getting my yaml file rejected by the GCP API Gateway. According to the docs here my path of /address/state/{state_id}/counties is a perfectly valid url, but I am getting this error.

com.google.apps.framework.request.BadRequestException: Cannot convert to service config.
'location: "unknown location"
kind: ERROR
message: "http: undefined field \'state_id\' on message \'google.protobuf.Empty\'."

I have validated my whole yaml file and it is valid. Here's the corresponding config (I won't include the whole file for security):

'/address/state/{state_id}/counties':
    get:
      produces:
        - application/json
      parameters:
        - in: path
          name: state_id
          required: true
          type: string
      responses:
        '200':
          description: Successful Response
          schema:
            items:
              $ref: '#/definitions/CountyFull'
            title: >-
              Response Get Counties By State Address State  State Id  Counties
              Get
            type: array
        '422':
          description: Validation Error
          schema:
            $ref: '#/definitions/HTTPValidationError'
      tags:
        - address
      description: Returns a list of counties by State
      operationId: get_counties_by_state_address_state__state_id__counties_get
      summary: Get Counties By State

What have I done to try and fix this?

I have checked the yaml file. I have changed the parameter name state-id stateId. I have tried making the yaml key not surrounded by '. I have googled and check as much documentation as I can. I have tried this:

      x-google-backend:
        address: https://path-to-my-service
        path_translation: APPEND_PATH_TO_ADDRESS

0 Answers0