I wanted to create a flask_restx schema that can parse something of the following:
"rules": [
{
"rules": [
{
"value": "gg"
},
{
"value": "Tenant Name"
}
],
"rule_type": "TENANT"
},
{
"rules": [
{
"operator": "CONTAINS",
"value": "gg"
}
],
"rule_type": "DEVICE_NAME"
},
]
Which is basically a list of rules, that each rule is a JSON with rule_type and a smaller list of rules. The smaller list of rules are corresponding to the rule_type (as you can see different rule_types has different rules fields, value vs value, operator
Seems like I need a List of nested values, which each nested value is a Polymorph (can be a list of rules of different types corresponding to the rule_type). Does this thing exist in flask_restx?
I know that list of nested is possible, but I'm not able to create a list of nested of polymorphs.