Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Empty messages skip validation in protojson.decode_message #9

Closed
julienr opened this issue Jun 14, 2015 · 0 comments
Closed

Empty messages skip validation in protojson.decode_message #9

julienr opened this issue Jun 14, 2015 · 0 comments
Assignees
Labels

Comments

@julienr
Copy link

julienr commented Jun 14, 2015

In protojson.decode_message, if encoded_message is an empty string, the validation will be skipped (and no ValidationError will be raised even if the message has some fields marked as required).

In https://github.com/google/protorpc/blob/master/protorpc/protojson.py#L201 , the following

if not encoded_message.strip():
  return message_type()

should be changed to

if not encoded_message.strip():
  message = message_type()
  message.check_initialized()
  return message
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants