Skip to content

If object uses additionalProperties: false and an input document contains a rogue key, obscure exception is raised #30

Closed
@terrisgit

Description

@terrisgit

I fed a schema that uses "additionalProperties": false everywhere to a Merger. I then sent a bad document (because a key wasn't defined in properties:) to the Merger and got an AttributeError exception. Partial trace is below. It took me about an hour to figure out that my document was invalid. Great that I got an exception; not so good that the exception made no sense.

    rv = self.call_descender(descender, schema, *args)
  File "/Users/terris/venv/edc/lib/python3.6/site-packages/jsonmerge/__init__.py", line 102, in call_descender
    return descender.descend_instance(self, schema, base, head, meta)
  File "/Users/terris/venv/edc/lib/python3.6/site-packages/jsonmerge/descenders.py", line 22, in descend_instance
    ref = schema.val.get("$ref")
AttributeError: 'bool' object has no attribute 'get'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions