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

ajv-keywords does not work with JTD #357

Open
katicode2 opened this issue Dec 6, 2022 · 1 comment
Open

ajv-keywords does not work with JTD #357

katicode2 opened this issue Dec 6, 2022 · 1 comment

Comments

@katicode2
Copy link

Description
I want to use the "transform"-keyword to perform a trim on certain string fields. But as soon as I want to add the ajv-keywords library and call addKeyword, I get the following error:

schema is invalid: data/type must NOT have additional properties, data must have property 'ref', data/type must be equal to one of the allowed values, data must have property 'enum', data must have property 'elements', data must have property 'properties', data must have property 'optionalProperties', data must have property 'discriminator', data must have property 'values', data must match a schema in union

Is there any documentation for this?

What version of Ajv are you using? Does the issue happen if you use the latest version?

8.11.2

Your code

import Ajv from 'ajv/dist/jtd';
import ajvKeywords from "ajv-keywords"

const ajv = new Ajv();
ajvKeywords(ajv, ["transform"]). // --> ERROR
@epoberezkin
Copy link
Member

You would have to modify keyword definitions in ajv-keywords to either remove metaSchema or change it to JTD schema.

It's possible to make it compatible with both in ajv-keywords.

Moving it to ajv-keywords.

@epoberezkin epoberezkin transferred this issue from ajv-validator/ajv Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants