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

Does AJV support for selective validation options? #2513

Open
buigiaanfb1 opened this issue Dec 11, 2024 · 1 comment
Open

Does AJV support for selective validation options? #2513

buigiaanfb1 opened this issue Dec 11, 2024 · 1 comment

Comments

@buigiaanfb1
Copy link

Hi AJV team,

First off, thank you for this amazing project! It’s been incredibly helpful for our work.

I have a question regarding AJV’s capabilities, and I’m curious if it currently supports this or if there’s a recommended approach to implement it.

We’re working on an incompleteness check feature for existing customer data in our application. This feature is part of a backend service used by multiple mini-apps. To make it more flexible, we aim to support two different validation options:

Basic completeness check: Only validate the presence of required fields to determine whether the customer data is fully filled out (including checks inside if-then-else conditions).
Full validation: Validate all constraints, including required, maxLength, minLength, and more, with allErrors enabled for comprehensive error reporting.
Currently, we are handling this manually by filtering the ErrorObject returned from AJV validation, depending on the option specified by the mini-app.

Does AJV have a built-in way to support such selective validation? If not, do you have any recommendations on how to implement this more efficiently?

Thank you for your time, and I look forward to your guidance!

@GabenGar
Copy link

Why not have two separate schemas?

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

No branches or pull requests

2 participants