Skip to content

Commit

Permalink
Fix handling of nullable argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter2206 committed Jun 25, 2018
1 parent 5714abd commit aca99fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions nadia/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ def translate_args(spec, **kwargs):
:return: A mapping containing keyword arguments used for constructing marshmallow objects.
:rtype: dict
"""

return {
'allow_none': spec.get('nullable', False),
'allow_none': kwargs.get('nullable', False),
'required': kwargs.get('required', False)
}

Expand Down
5 changes: 4 additions & 1 deletion nadia/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def construct_attributes_schemas(self, spec):
attr_type = prop_content['type']
attr_schemas_builder = self.builder_provider.get_builder(attr_type)
attr_required = prop_name in spec.get('required', [])
attr_schemas[prop_name] = attr_schemas_builder.build_schema(prop_content, required=attr_required)
attr_schemas[prop_name] = attr_schemas_builder.build_schema(
prop_content,
required=attr_required,
nullable=prop_content.get('nullable', False))
return attr_schemas

@staticmethod
Expand Down

0 comments on commit aca99fe

Please sign in to comment.