-
Notifications
You must be signed in to change notification settings - Fork 195
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
How do you use ajv with references? #2003
Comments
Hey @bodinsamuel, you can iterate over each |
@bodinsamuel Were you able to make this solution work? If so, would you mind posting some sample code? I have a similar issue and the iteration solution isn't working for me. |
hey I didn't managed to make the addSchema works (but I didn't took much time looking at it), I did that: const ajv = new Ajv({ allErrors: true, discriminator: true });
addFormats(ajv);
const validator = ajv.compile({ ...jsonSchema, ...jsonSchema['definitions'][modelName] }); Basically it append the model at the root level and keep the |
Thanks for replying so quickly! It turns out I was also being hit by this bug: #1732 When
|
Hi,
Sorry for the dumb question but I'm struggling a bit to use this package.
I'm exporting multiple Typescript interface, so I end up with a file like this:
However when it's time to actually use the json schema I'm lost.
I tried using
ajv
but I'm failing to understand how to validate one interface with a Reference using this json schema. There is no documentation regarding this use case so I'm wondering.Without a reference I can just load the schema with the appropriate key but when there is references it won't work
Is there any way to tell
ajv
to validateTest1
inside the schema?Or any other way to achieve that.
Thanks☺️
The text was updated successfully, but these errors were encountered: