Skip to content

Confusing exception with GET methods and request bodies #126

@inklesspen

Description

@inklesspen

If a method is defined with http_method GET and the method has a message or resource container as the request body, and that request body has fields which aren't in the resource container, a strange and confusing exception arises.

Repro by cloning https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/endpoints-frameworks-v2/echo/main.py and changing 'POST' to 'GET'

    descriptor = self.get_openapi_dict(services, hostname)
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 1011, in get_openapi_dict
    return self.__api_openapi_descriptor(services, hostname=hostname)
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 915, in __api_openapi_descriptor
    security_definitions)
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 726, in __method_descriptor
    path)
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 589, in __request_message_descriptor
    method_id)
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 543, in __params_descriptor
    params.append(self.__body_parameter_descriptor(method_id))
  File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 365, in __body_parameter_descriptor
    self.__request_schema[method_id])
KeyError: 'echo.echo'

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