Skip to content

How to implement ajv-keywords with rjsf @rjsf/validator-ajvX? #3972

@michal-kurz

Description

@michal-kurz

Prerequisites

What theme are you using?

core

What is your question?

I want to use the uniqItemProperties keyword from ajv-keyword library - how can I make this work with @rjsf/validator-ajvX?

I am using ajv-6 validator invoked like this:

import { customizeValidator } from '@rjsf/validator-ajv6'
const validator = customizeValidator({ customFormats: CUSTOM_FORMAT_CRITERIA as any })

The custom keyword should be applied to the ajv instance itself like so:

require('ajv-keywords')(ajv, ['uniqueItemProperties'])

ajv-keyword then calls ajv.addKeyword() on the ajv instance - is there a clean way of applying it with @rjsf/validator-ajv6?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions