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

Add Output Error Types when Schema validation fails #132

Open
CheesyBoy123 opened this issue May 19, 2024 · 0 comments
Open

Add Output Error Types when Schema validation fails #132

CheesyBoy123 opened this issue May 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@CheesyBoy123
Copy link
Contributor

Describe the feature

When doing schema validation, it is useful to know what went wrong in a very easy way. For example if you have the schema:

field:
  type: string
  required: true

But you do not pass this field, you would see that the validation has failed. It would be extremely hard to know why the validation failed. Was it because the type was invalid or the field was missing all together? Currently, if you wanted to know you would have to parse the error messages:

Instance does not have required property \"" + key + "\"" <--- Required but missing
"Instance type " + instanceType + " is invalid. Expected " + schema.get("type") <--- The type is invalid

I think adding a new Enum valid to describe the error type would be extremely helpful.

Use cases

Since the program knows why the validation failed, it can gracefully catch the exception and pass that on to the end user in a cleaner fashion.

Contribution

Who should implement this feature ? are you volunteering for implementing this feature or
do you know that is able and willing implement this feature ?

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

No branches or pull requests

1 participant