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

provides validation result for more than SingleIssue? #38

Open
YongHeeK opened this issue Sep 10, 2021 · 2 comments
Open

provides validation result for more than SingleIssue? #38

YongHeeK opened this issue Sep 10, 2021 · 2 comments

Comments

@YongHeeK
Copy link
Contributor

Currentely validate(data, schema) only returns SingleIssue, even if there are more than 1 failure.

using JSON, JSONSchema
data = JSON.parse("""{
    "Title": null,
    "Desc": 15
}
""")

schema = JSON.parse("""{
    "properties": {
        "Title": {
            "type": "string"
        },
        "Desc": {
            "type": "string"
        }
    }
}
""")

JSONSchema.validate(data, Schema(schema))

But I'm trying to setup JSONSchema validation on github action with large and complex data. So, it's preferable to present all the issues from the sigle run.

How about adding validateall, which returns Array{SingleIssue, 1} for all the validations?

@odow
Copy link
Collaborator

odow commented Sep 10, 2021

This is a feature addition and non-breaking, so go for it.

validateall

How about instead of a new function, we add validate(schema, data; fail_fast::Bool = true)?

Then you could run validate(schema, data; fail_fast = false) to return the vector of failures?

@YongHeeK
Copy link
Contributor Author

Ok. adding fail_fastkeyword looks better than my suggestion😄
I will comeup with PR

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

No branches or pull requests

1 participant