Skip to content

additionalProperties should store off the unexpected extra properties #409

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

Closed
ogenodisho opened this issue May 18, 2018 · 1 comment
Closed
Labels
Enhancement Some new desired functionality

Comments

@ogenodisho
Copy link

I am trying to obtain all keys that caused validation errors using the ErrorTree object but I can't seem to do it. (Please see my stackoverflow question for more detail: https://stackoverflow.com/questions/50401837/getting-invalid-key-values-from-jsonschema-using-python)

Here is the code I am using:

def get_errors_in_tree(error_tree):
    errors = []
    if error_tree.total_errors <= 1:
        return map(lambda ve: list(ve.instance.keys()),  error_tree.errors.values())
    for error in error_tree:
        errors.extend(get_errors_in_tree(error_tree[error]))
    return errors

But this isn't working - it's only giving me some of the keys. Could I please get more guidance on how to achieve this?

@Julian
Copy link
Member

Julian commented May 19, 2018

Hi.

This is discussed tangentially in #119, it's basically the other known case where this information isn't present.

Have a look there, though I can leave this open as one specifically about additionalProperties.

Patches welcome of course.

@Julian Julian changed the title How to retrieve all invalid keys from a jsonschema ErrorTree additionalProperties should store off the unexpected extra properties May 19, 2018
@Julian Julian added the Enhancement Some new desired functionality label Aug 13, 2018
@Julian Julian closed this as completed Jan 14, 2019
Julian added a commit that referenced this issue Jun 20, 2020
fc05651cc Merge pull request #409 from Stranger6667/dd/add-jsonschema-rs
5f1575a93 Add Rust `jsonschema` crate
2bf95beec Merge pull request #407 from fisxoj/master
9ae956b21 Add common lisp implementation to the list
d4ffd569b Merge pull request #401 from json-schema-org/ether/format-uuid
2d6c45711 tests for the "uuid" format
08f6cdaff Merge pull request #400 from json-schema-org/ether/more-format-ipv6
d3064eb3a some more tests for the "ipv6" format
1f34d3321 Merge pull request #399 from json-schema-org/ether/more-format-idn-email
22adda78c also test the "email" inputs against "idn-email"
25598a3b4 Merge pull request #392 from rjmill/rjmill/test-prop-named-ref-containing-a-ref
8dfa8adc9 Merge pull request #380 from ChALkeR/fix-ecmascript-regex
d595dbf9d backport $ref cases, changing "$defs" to "definitions"
ca8319c9e Fix \W test description
452b5f8f4 Test property named $ref, containing an actual $ref
a01ae5404 Fix ECMA 262 regex whitespace tests.

git-subtree-dir: json
git-subtree-split: fc05651cce3889975f8dbcca38c203d6a396694b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Some new desired functionality
Projects
None yet
Development

No branches or pull requests

2 participants