Skip to content
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

Get all validation errors in an Dict #79

Open
edyan opened this issue Jul 16, 2017 · 5 comments
Open

Get all validation errors in an Dict #79

edyan opened this issue Jul 16, 2017 · 5 comments
Assignees

Comments

@edyan
Copy link

edyan commented Jul 16, 2017

Hi,

For now the validate() method returns only the first encountered error. I would like to know if we can get all, in a dict for example:
{ 'keya': ["True is not of type 'string'"], 'keyb': ["True is not of type 'string'"] }

Also, I noticed that the doc here https://github.com/ssato/python-anyconfig/blob/master/anyconfig/schema.py#L45 is not up to date. safe is not part of options ;)

Thanks !

@ssato
Copy link
Owner

ssato commented Jul 19, 2017

Thanks for the report!

For now the validate() method returns only the first encountered error. I would like to know
if we can get all, in a dict for example:
{ 'keya': ["True is not of type 'string'"], 'keyb': ["True is not of type 'string'"] }

I'm not sure it's possible but will take some time to study it. Please wait for a while.

Also, I noticed that the doc here https://github.com/ssato/python-anyconfig/blob/master/anyconfig/schema.py#L45 is not up to date. safe is not part of options ;)

You're absolutely right I'll also look into this maybe this weekend.

@ssato
Copy link
Owner

ssato commented Aug 3, 2017

I think that a couple of commits like 518d7bc improve the following:

Also, I noticed that the doc here https://github.com/ssato/python-anyconfig/blob/master/anyconfig/schema.py#L45 is not up to date. safe is not part of options ;)

You're absolutely right I'll also look into this maybe this weekend.

@ssato
Copy link
Owner

ssato commented Sep 18, 2017

Very sorry to late reply.

I add support of this function in an experimental branch named 'schema'.
Could you please look at the commit 6447858 (especially its test case) and try it if possible?

If it looks OK, I'll merge it.

@edyan
Copy link
Author

edyan commented Sep 20, 2017

Hi Satoru

Thanks for doing that. I would say it's not far from being perfect (from my point of view). The message is clear but .... (sorry for the bug) we don't know what messages belongs to what key.

In your example, I would expect :
{"a": ["'abc' is not of type 'boolean'"]}

If that's doable that would be great.

Thanks again
Emmanuel

@ssato ssato self-assigned this Sep 24, 2017
@ssato
Copy link
Owner

ssato commented Jan 3, 2018

I took some time to accomplish what you want, but unfortunately, I think that it's very hard to do that w/o modifying jsonschema other than anyconfig.

Now, I merged the change I did as an workaround to master branch instead as an workaround and keep this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants