Skip to content

@accepts with schema and many=True and empty list yields an error #125

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

Open
isaacm opened this issue May 12, 2025 · 0 comments · May be fixed by #126
Open

@accepts with schema and many=True and empty list yields an error #125

isaacm opened this issue May 12, 2025 · 0 comments · May be fixed by #126

Comments

@isaacm
Copy link

isaacm commented May 12, 2025

If you have a schema configured like:

@responds(schema=MySchema(many=True))
def post(self):
            return Widget(**request.parsed_args)

And you make a request like

POST {url}
---
[]

You'll get an error about invalid schema type.

{'_schema': ['Invalid input type.']}

I think this change circulon@e44eccb#diff-7f8879c8c7ad079ebd08c6a9cb1648f4821d23409ae12e18e4b72d3e7bd8ef46R117 does not handle schemas with many=True and an empty payload represented by []

  • many=True should default to []
  • many=False should default to {}

I'm using the latest version available biw on pypi 1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant