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

Update validation to support custom keywords #22

Merged
merged 1 commit into from
Feb 13, 2020

Conversation

bsonntag
Copy link
Contributor

@bsonntag bsonntag commented Feb 13, 2020

This updates the validation options to support passing custom keywords.

Example:

const jsonSchema = {
  properties: {
    foo: {
      myCustomKeyword: ...
    }
  }
};

const validationOptions = {
  keywords: {
    myCustomKeyword: {
      validate: () => {
        // ...
      }
    }
  }
};

<FormProvider
  jsonSchema={jsonSchema}
  onSubmit={onSubmit}
  validationOptions={validationOptions}
>

See ajv's documentation for more information about custom keywords: https://github.com/epoberezkin/ajv/blob/master/CUSTOM.md

@bsonntag bsonntag added the enhancement New feature or request label Feb 13, 2020
@bsonntag bsonntag force-pushed the enhancement/ajv-custom-keywords branch from f508f55 to 0533062 Compare February 13, 2020 13:29
@franciscomorais franciscomorais merged commit 85ec775 into master Feb 13, 2020
@joaonice joaonice deleted the enhancement/ajv-custom-keywords branch February 13, 2020 13:47
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

Successfully merging this pull request may close these issues.

2 participants