Skip to content

instance and type='required' challenges #219

Description

@lwjohnst86

Here, we rewrite jsonpath so that for type="required" errors it ends in the missing field's name. I think that (regardless of having solved the hash problem) this should be matched by rewriting instance for required errors in the same way. Otherwise, we will end up with output like:

# check({"resources": [{"title": "Title"}]}, error=True)

At package.resources[0].name:
|
| name: {'title': 'Title'}
|       ^^^^^^^^^^^^^^^^^^
'name' is a required property

It would be nice if this could happen here and not in _create_issue, but I don't know off the top of my head if that would be problematic for any logic that relies on instance on SchemaErrors.

Originally posted by @martonvago in #208 (comment)


Interesting, do you think this is something that can be solved in a separate PR? It's not immediately clear how to differentiate the two errors I get from running your example:

Image

The first one seems correct whereas the second one has the issue you highlighted.

Originally posted by @joelostblom in #208 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions