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

Fix Colander validator missing body, path, etc. #545

Merged
merged 1 commit into from
Aug 31, 2020

Conversation

antoineleclair
Copy link
Contributor

@antoineleclair antoineleclair commented Aug 26, 2020

The issue was introduced with commit
40ed37a

Validators that had attributes like body was broken
(body was missing in request.validated). For example:

class EmailContentSchema(MappingSchema):
    subject = SchemaNode(String())
    body = SchemaNode(String())

@send_email_service.post(
    schema=EmailContentSchema(),
    validators=(colander_body_validator,),
)
def send_email_post(request):
    send_email(
        request.validated["subject"],
        request.validated["body"] # was missing
    )
    return HTTPOk()

The issue was with body, headers, path, querystring when using:

  • body_validator
  • headers_validator
  • path_validator
  • querystring_validator

The issue was introduced with commit
40ed37a

Validators that had attributes like 'body' was broken
('body' was missing in request.validated). For example:

class EmailContentSchema(MappingSchema):
    subject = SchemaNode(String())
    body = SchemaNode(String())

@send_email_service.post(
    schema=EmailContentSchema(),
    validators=(colander_body_validator,),
)
def send_email_post(request):
    send_email(
        request.validated["subject"],
        request.validated["body"] # was missing
    )
    return HTTPOk()

The issue was with body, headers, path, querystring when using:
* body_validator
* headers_validator
* path_validator
* querystring_validator
Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thanks!

@leplatrem leplatrem merged commit 8b1878f into Cornices:master Aug 31, 2020
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.

2 participants