Validation keywords for primitives in arrays
See original GitHub issueWould be nice if we could specify validation keywords for primitive array items. Example:
export interface Test {
/**
* @multipleOf 10
*/
numbersArray?: number[];
}
now converts to
"Test": {
"additionalProperties": false,
"properties": {
"numbersArray": {
"items": {
"type": "number"
},
"multipleOf": 10,
"type": "array"
},
},
"type": "object"
}
but should instead be converted to
"Test": {
"additionalProperties": false,
"properties": {
"numbersArray": {
"items": {
"type": "number",
"multipleOf": 10
},
"type": "array"
},
},
"type": "object"
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
A Vocabulary for Structural Validation of JSON - JSON Schema
Validation Keywords for Arrays ... String values MUST be one of the six primitive types ("null", "boolean", "object", "array", "number", ...
Read more >JSON Schema Validation: A Vocabulary for Structural ... - IETF
For arrays, primitive type validation consists of validating restrictions on ... Each JSON Schema validation keyword adds constraints that an instance must ...
Read more >ajv-keywords - Ajv JSON schema validator
The keyword allows to check that some properties in array items are unique. This keyword applies only to arrays. If the data is...
Read more >JSON Schema: How to check that an array contains at least ...
The value of this keyword MUST be a valid JSON Schema. An array instance is valid against "contains" if at least one of...
Read more >Validate.io-string-primitive-array NPM | npm.io
Validates if a value is an array of string primitives. Installation. $ npm install validate.io-string-primitive-array. For use in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It doesn’t look like TJS picks up type annotations for properties:
gets converted to
The original issue was about specifying information about the elements of an array. I am trying to do this as well.
I tried an approach like this:
but it doesn’t seem to set
items
for some reason.