Required fields within array of object
See original GitHub issueExpected behavior
Required fields should validate within an array ‘items’ object.
Actual behavior
Validation does not occur
Steps to reproduce the behavior
Schema as shown;
{
"type": "array",
"format": "tabs",
"title": "Cronjobs",
"items": {
"type": "object",
"title": "Job",
"format": "grid",
"headerTemplate": "{{ self.title }}",
"additionalProperties" : false,
"required": [
"title",
"job",
"minute",
"hour",
"day",
"month",
"year"
],
"properties": {
"title": {
"title": "Title",
"type": "string"
},
"job": {
"title": "Job",
"type": "string"
},
"minute": {
"title": "Minute",
"type": "string",
"default": "*"
},
"hour": {
"title": "Hour",
"type": "string",
"default": "*"
},
"day": {
"title": "Day",
"type": "string",
"default": "*"
},
"month": {
"title": "Month",
"type": "string",
"default": "*"
},
"year": {
"title": "Year",
"type": "string",
"default": "*"
},
"active": {
"title": "Active",
"type": "boolean",
"format": "checkbox",
"default": true
}
}
}
}
All fields for each item should be required, however they can be blank and validation reports no issues. The above schema validates array items correctly at https://www.jsonschemavalidator.net/ so there should be no issues with the schema itself.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
From an array of objects, extract value of a property as array
Example to collect the different fields from the object array ... provided list to an array containing either the requested field or the...
Read more >Validating Array objects for required fields, .exists() - doesn't ...
Is there a way to force that a field must be present in array object? the exists() doesn't seem to work for arrays....
Read more >Performing a $lookup on Object Fields within an Array of ...
I'm trying to come up with an aggregation pipeline that will allow me to obtain some information from an enumerations collection which has...
Read more >Arrays | Elasticsearch Guide [8.5] | Elastic
In Elasticsearch, there is no dedicated array data type. Any field can contain zero or more values by default, however, all values in...
Read more >Nested Objects and Arrays - VeeValidate
fields : a read-only version of your array field items, it includes some useful properties like key , isFirst and isLast , 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
In the json-schema world required does not mean that some value must be set. It means that the value must be present (valid also if its empty).
What you need is “minLength”, probably.
https://json-schema.org/understanding-json-schema/reference/object.html#required-properties
You can set the
required
property for a property, but this is connected to json-schema’srequired
, which means that the key has to exist in the JSON output.@germanbisurgi Could you have a look at the part for the atttributes
required placeholder="Placeholder text"
- please open a new issue, if needed.