anyOf Keyword Pattern Support

Use the anyOf keyword to ensure that the given data is valid against any of the subschemas.

Note:

The following anyOf keyword patterns are not currently supported.
  • anyOf defined as items of top level array
  • anyOf with a subschema being of simple type

Any other patterns not listed in the following sections should also be considered unsupported.

Oracle Integration supports the following anyOf keyword patterns.

anyOf with All Subschemas Defined as $ref

You can use an anyOf pattern in which all subschemas are defined as a reference ($ref).

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemProperties"
                    },
                    {
                        "$ref": "#/components/schemas/ItemProductionPrivateVO-item"
                    },
                    {
                        "$ref": "#/components/schemas/ItemProductionPrivateVO-item-response-forChildren"
                    }
                ]
            }
        }
    }
}

anyOf with All Subschemas Defined Inline

You can use an anyOf pattern with all subschemas defined inline.

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "required": [
                            "count",
                            "hasMore"
                        ],
                        "type": "object",
                        "properties": {
                            "totalResults": {
                                "type": "integer",
                                "format": "int32"
                            },
                            "count": {
                                "type": "integer",
                                "format": "int32"
                            },
                            "hasMore": {
                                "type": "boolean"
                            }
                        }
                    },
                    {
                        "type": "object",
                        "properties": {
                            "items": {
                                "title": "Items",
                                "type": "array",
                                "description": "The items in the collection.",
                                "items": {
                                    "$ref": "#/components/schemas/itemsV2-ItemEffCategory-item-response"
                                },
                                "x-cardinality": "1"
                            }
                        }
                    }
                ]
            }
        }
    }
}

anyOf with Subschemas Being a Mix of Inline and $ref

You can use an anyOf pattern with subschemas being a mix of inline and references ($ref).

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/CollectionProperties"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "items": {
                                "title": "Items",
                                "type": "array",
                                "description": "The items in the collection.",
                                "items": {
                                    "$ref": "#/components/schemas/itemsV2-ItemEffCategory-item-response"
                                },
                                "x-cardinality": "1"
                            }
                        }
                    }
                ]
            }
        }
    }
}

anyOf Defined as Item of an Array Type

You can use an anyOf pattern defined as an item of an array type.

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "properties": {
                    "repeatingElement": {
                        "description": "The items in the collection.",
                        "items": {
                            "anyOf": [
                                {
                                    "$ref": "#/components/schemas/ItemProperties"
                                },
                                {
                                    "$ref": "#/components/schemas/ItemProductionPrivateVO-item"
                                }
                            ]
                        },
                        "title": "repeatingElement",
                        "type": "array",
                        "x-cardinality": "1"
                    },
                    "someStringElement": {
                        "type": "string"
                    }
                },
                "type": "object"
            }
        }
    }
}

anyOf with a Nested anyOf Subschema Defined as $ref

You can use an anyOf pattern in which a nested anyOf subschema is defined as a reference ($ref).

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-patch-item"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-item-patch-request-forChildren"
                    }
                ]
            },
            "ItemRootIccPrivateVO-patch-item": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemEffCategoryVO-patch-item"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-updatableFields"
                    }
                ],
                "title": "Item Extensible Flexfield"
            },
            "ItemRootIccPrivateVO-item-patch-request-forChildren": {
                "type": "object",
                "properties": {
                    "ItemEFFBItem__Details__EFFPrivateVO": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/itemsV2-ItemEffCategory-item-patch-request"
                        },
                        "x-cardinality": "1"
                    }
                }
            }
        }
    }
}

anyOf with a Nested anyOf Subschema Defined Inline

You can use an anyOf pattern in which a nested anyOf subschema is defined inline.

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "anyOf": [
                            {
                                "$ref": "#/components/schemas/ItemEffCategoryVO-patch-item"
                            },
                            {
                                "$ref": "#/components/schemas/ItemRootIccPrivateVO-updatableFields"
                            }
                        ],
                        "title": "Item Extensible Flexfield"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-item-patch-request-forChildren"
                    }
                ]
            }
        }
    }
}

anyOf with a Nested allOf Subschema Defined as $ref

You can use an anyOf pattern in which a nested allOf subschema is defined as a reference ($ref).

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-patch-item"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-item-patch-request-forChildren"
                    }
                ]
            },
            "ItemRootIccPrivateVO-patch-item": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/ItemEffCategoryVO-patch-item"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-updatableFields"
                    }
                ],
                "title": "Item Extensible Flexfield"
            },
            "ItemRootIccPrivateVO-item-patch-request-forChildren": {
                "type": "object",
                "properties": {
                    "ItemEFFBItem__Details__EFFPrivateVO": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/itemsV2-ItemEffCategory-item-patch-request"
                        },
                        "x-cardinality": "1"
                    }
                }
            }
        }
    }
}

anyOf with a Nested allOf Subschema Defined Inline

You can use an anyOf pattern in which a nested allOf subschema is defined inline.

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/ItemEffCategoryVO-patch-item"
                            },
                            {
                                "$ref": "#/components/schemas/ItemRootIccPrivateVO-updatableFields"
                            }
                        ],
                        "title": "Item Extensible Flexfield"
                    },
                    {
                        "$ref": "#/components/schemas/ItemRootIccPrivateVO-item-patch-request-forChildren"
                    }
                ]
            }
        }
    }
}

anyOf with a Nested oneOf Subschema Defined as $ref

You can use an anyOf pattern in which a nested oneOf subschema is defined as a reference ($ref).

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemEffCategoryVO-patch-item"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "items": {
                                "title": "Items",
                                "type": "array",
                                "description": "The items in the collection.",
                                "items": {
                                    "$ref": "#/components/schemas/itemsV2-ItemEffCategory-item-response"
                                },
                                "x-cardinality": "1"
                            }
                        }
                    }
                ]
            },
            "ItemEffCategoryVO-patch-item": {
                "discriminator": {
                    "propertyName": "CategoryCode",
                    "mapping": {
                        "Production": "schemas/ItemProductionPrivateVO-item-response",
                        "ROOT_ICC": "schemas/ItemRootIccPrivateVO-item-response"
                    }
                },
                "oneOf": [
                    {
                        "$ref": "schemas/ItemProductionPrivateVO-item-response"
                    },
                    {
                        "$ref": "schemas/ItemRootIccPrivateVO-item-response"
                    }
                ]
            }
        }
    }
}

anyOf with a Nested oneOf Subschema Defined Inline

You can use an anyOf pattern in which a nested oneOf subschema is defined inline.

{
    "components": {
        "schemas": {
            "ItemRootIccPrivateVO-item-patch-request": {
                "anyOf": [
                    {
                        "$ref": "#/components/schemas/ItemProperties"
                    },
                    {
                        "discriminator": {
                            "propertyName": "CategoryCode",
                            "mapping": {
                                "Production": "#/components/schemas/ItemProductionPrivateVO-item-response",
                                "ROOT_ICC": "#/components/schemas/ItemRootIccPrivateVO-item-response"
                            }
                        },
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/ItemProductionPrivateVO-item-response"
                            },
                            {
                                "$ref": "#/components/schemas/ItemRootIccPrivateVO-item-response"
                            }
                        ]
                    }
                ]
            }
        }
    }
}