-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: dictionary update sequence element #0 has length 3; 2 is required #55
Comments
And in which cases may have several request schemas? |
In my opinion it is more correct and clear to have a name for each value in request body. class Person(Schema):
name = fields.String()
class ManyPersons(Schema):
persons = fields.Nested(Person, many=True) Now you can use ManyPersons schema in
I think that it is more understandable approach for API users. I will think about your case as well. I will try to make a patch to fix it. |
This error also occurs when deserialising to objects. For example: class SomeObject(typing.NamedTuple):
x: int
y: int
class SomeObjectSchema(Schema):
x = fields.Int()
y = fields.Int()
@post_load
def make_object(self, data: dict):
return SomeObject(**data)
@request_schema(SomeObjectSchema())
async def index(request):
# ... |
PR #57 fixes this for me, but I'm not sure if that solves @v-v-vishnevskiy's exact problem too. |
This happens when I try to send something like this in body:
with appropriate request schema.
The error in this line https://github.com/maximdanilchenko/aiohttp-apispec/blame/master/aiohttp_apispec/middlewares.py#L37
kwargs
is dictionary and can't update with list or tuple.The text was updated successfully, but these errors were encountered: