nexxbiz / JLio

The project aims to be able to run a JSON noted transformation script to transform other JSON objects.
https://JLio.online
MIT License
5 stars 1 forks source link

Support for oneOf for the filterBySchema function #66

Open MariusVuscanNx opened 7 months ago

MariusVuscanNx commented 7 months ago

Given a json schema:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
        "BA": {
            "oneOf": [
                {
                    "properties": {
                        "someProp": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                {
                    "items": {
                        "properties": {
                            "someProp": {
                                "type": "string"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                }
            ]
        }
    }
}

running the filterBySchema function on a json:

{
    "BA": {
        "someProp": "123",
        "someProp": "1234"
    }
}

will result in emptying the object/array property.

{
    "BA": {}
}

while the expected result would be:

{
    "BA": {
        "someProp": "123"
    }
}