ajv
ajv copied to clipboard
fix #2427 compileAsync a schema with discriminator and $ref
Make the discriminator code generation throw MissingRefError when the $ref does not synchronously resolve so that compileAsync can loadSchema and retry.
What issue does this pull request resolve? #2427
What changes did you make? Make the discriminator code generation throw MissingRefError when the $ref does not synchronously resolve so that compileAsync can loadSchema and retry.
Is there anything that requires more attention while reviewing?
The existing tests create separate test Ajv
instances by calling withStandalone(getAjvInstances(AjvClass, …))
(https://github.com/ajv-validator/ajv/blob/v8.13.0/spec/discriminator.spec.ts#L22). I could not directly reuse those Ajv
instances because I need to add the loadSchema
option and I can’t call compileAsync on an Ajv
after withStandalone
. For now I only called new _Ajv
. To what extent should I try creating separate ajv, ajv2019, standalone instances in the test?
I've made some small changes just to get it passing linting and see how the tests run.
Not sure why coveralls is erroring. Will try a clean branch and see if I get the same issue.
This has been moved to #2433 due to coveralls issues.