Skip to content
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

Skip choices for nullable argument in RequestParser #742

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adzhurinskij
Copy link

@adzhurinskij adzhurinskij commented Oct 22, 2019

Hi.

It's fix popular case with arguments which can be choices or nullable.

parser = reqparse.RequestParser()
parser.add_argument('description', type=str, required=False, store_missing=False, nullable=True)
parser.add_argument('location_id', type=int, required=False, store_missing=False, nullable=True, choices=db.session.query(Locations.id).filter(Locations.deleted_at.is_(None)).values())
args = parser.parse_args(strict=True)

@andreixk
Copy link

@adzhurinskij You need to modify unit tests accordingly in order to ensure the checks are passing.

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 this pull request may close these issues.

None yet

2 participants