You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given this example from the python-docs-sample repository:
classGreeting(messages.Message):
"""Greeting that stores a message."""message=messages.StringField(1)
@endpoints.method(endpoints.ResourceContainer(Greeting,times=messages.IntegerField(2, variant=messages.Variant.INT32,required=True))Greeting,path='greetings/multiply/{times}',http_method='POST',name='greetings.multiply')defmultiply_greeting(self, request):
returnGreeting(message=request.message*request.times)
I find strange that the Greeting request body and times query parameter get "mixed" into a CombinedContainer object personified by request.
If I compare with Java, all of the parameters appear independently in the Java method signature.
For example:
That appears more logical and less error-prone to me.
Could it possible to have the same behavior in Python? Or was it designed that way on purpose?
As a workaround, what would be a generic way to turn any CombinedContainer into an object as defined in the ResourceContainer?
Thanks!
The text was updated successfully, but these errors were encountered:
dalbani
changed the title
Method with request body *and* query parameters become combined
Method's request body *and* query parameters become combined
Nov 5, 2016
Given this example from the
python-docs-sample
repository:I find strange that the
Greeting
request body andtimes
query parameter get "mixed" into aCombinedContainer
object personified byrequest
.If I compare with Java, all of the parameters appear independently in the Java method signature.
For example:
That appears more logical and less error-prone to me.
Could it possible to have the same behavior in Python? Or was it designed that way on purpose?
As a workaround, what would be a generic way to turn any
CombinedContainer
into an object as defined in theResourceContainer
?Thanks!
The text was updated successfully, but these errors were encountered: