-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
Unknown attributes AJV and typescript #2082
Comments
JSONSchemaType doesn't support catch-all index syntax. Even with typescript, I think |
@epoberezkin typescript does what I intend to do :) They give me warning that something is required, but lots of other things can be in the same object. So im happy with the TS implementation, but would love to be able to validate this as well somehow? |
What I meant is that if you add In general, even though JavaScript and TypeScript allow mixing records and dictionaries in the same object, it's usually better to keep them separate, limiting records to known properties only (without any unknown additional properties). If the intention is to allow additional properties in JSON, it's ok, but you don't have to declare them in the type - you can just add |
@epoberezkin thanks for quick reply! But I had updated my message with that specific worry you had. It catches that as well. But thanks for the feedback. I will have to think about it. Will close tomorrow! |
What version of Ajv are you using? Does the issue happen if you use the latest version?
8.11
Your typescript code
Typescript compiler error messages
Describe the change that should be made to address the issue?
How shall I be able to represent the current type with ajv?
I did not find a solution in this issue: #1521
Are you going to resolve the issue?
I will resolve when I get some feedback
The text was updated successfully, but these errors were encountered: