We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What version of Ajv are you using? Does the issue happen if you use the latest version?
8.11.0 (latest at time of writing)
Ajv options object
undefined
JSON Type Definition
{ values: {} }
Sample data
Your code
import Ajv from "ajv/dist/jtd"; const ajv = new Ajv(); console.log(ajv.validate({ values: {} }, undefined)); // true, expected false console.log(ajv.validate({ values: {} }, null)); // true, expected false console.log(ajv.validate({ values: {} }, 1)); // true, expected false console.log(ajv.validate({ values: {} }, "foo")); // true, expected false
Validation result, data AFTER validation, error messages
true
What results did you expect?
I expected false. Unless I misunderstand the documentation, { values: {} } is equivalent to Record<string, any>, but it appears to be treated as any.
false
Record<string, any>
any
Are you going to resolve the issue?
First I'm interested to know if I'm mistaken. I haven't taken a look at the source code to know if I might be able to resolve it myself.
My workaround for the moment is to replace { values: {} } with { optionalProperties: { foo: {} }, additionalProperties: true }.
{ optionalProperties: { foo: {} }, additionalProperties: true }
The text was updated successfully, but these errors were encountered:
This is indeed a bug - it happens with an empty "values" form.
As a workaround, you should be using "properties" form without properties.
Sorry, something went wrong.
JTD empty values schema, fixes #1949
006eaab
a211e8d
No branches or pull requests
What version of Ajv are you using? Does the issue happen if you use the latest version?
8.11.0 (latest at time of writing)
Ajv options object
undefined
JSON Type Definition
Sample data
undefined
Your code
Validation result, data AFTER validation, error messages
What results did you expect?
I expected
false
. Unless I misunderstand the documentation,{ values: {} }
is equivalent toRecord<string, any>
, but it appears to be treated asany
.Are you going to resolve the issue?
First I'm interested to know if I'm mistaken. I haven't taken a look at the source code to know if I might be able to resolve it myself.
My workaround for the moment is to replace
{ values: {} }
with{ optionalProperties: { foo: {} }, additionalProperties: true }
.The text was updated successfully, but these errors were encountered: