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

Validate key without making it required? #119

Open
marcysutton opened this issue Aug 2, 2017 · 0 comments
Open

Validate key without making it required? #119

marcysutton opened this issue Aug 2, 2017 · 0 comments

Comments

@marcysutton
Copy link

I want to validate a schema to catch incorrect keys while keeping them optional. I've looked through the options, but I'm not sure if this is possible.

Here's a small portion of my schema for accessibility checks, I want to validate the key incomplete while keeping it optional:

messages: {
	required: true,
	type: 'object',
	properties: {
		fail: {
			required: true,
			type: 'string'
		},
		pass: {
			required: true,
			type: 'string'
		},
		incomplete: {
			type: ['string', 'object']
		}
	}
}

The only thing I've gotten revalidator to complain about is if I make incomplete required. The motivation for this change is I want to prevent check authors from using undefined: {} instead of incomplete: {}, where only some checks will have incomplete messages specified (hence the optional bit).

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