Validate array JSON schema - using JS

0

I'm trying to run unit tests with this JSON schema:

"Transactions":{
                "$id": "http://example.com/example.json/items",
                "type": "object",
                "additionalProperties": false,
                "properties": {                    
                    "UUU" : {
                        "description": "Valor UUU",
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 1,
                        "required": true,
                        "items":[
                            {
                            "quantity": {
                                "$id": "http://example.com/example.json/items",
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "ValUU": {
                                        "description": "Valor em UU",
                                        "$id": "http://example.com/example.json/items/properties/paragraphs/properties/impact",
                                        "type": "number",
                                        "title": "Valor UU",
                                        "minimum": 0,
                                        "maximum": 999999999999,
                                        "required": true
                                        },
                                    "ValU": {
                                        "description": "Valor U",
                                        "$id": "http://example.com/example.json/items/properties/paragraphs/properties/impact",
                                        "type": "number",
                                        "title": "Valor U",
                                        "minimum": 0,
                                        "maximum": 99999999999,
                                        "required": true
                                        }
                                    }
                                },

UUU is an array that is receiving the "quantity" item, and this item has two objects inside it, I need to know a Javascript query to validate those objects within "quantity". I can only communicate with the UUU array and say that it has an item.

    
asked by anonymous 25.10.2018 / 15:14

0 answers