79826370

Date: 2025-11-21 10:05:45
Score: 0.5
Natty:
Report link

Thanks for your detailed Answer. In my previous example it's just a List of properties and the allOf is not needed - I get this. I'm still not 100% sure when to use allOf though. I tried studying the Json Schema but I'm still kinda unsure.

In the following example I add together multiple schemas which are not just parameters, but objects. Would that be a usecase for the keyword?

{
    "schemas": {
        "BulkLimit": {
            "type": "object",
            "allOf": [
                {
                    "$ref": "#/components/schemas/Limit"
                },
                {
                    "type": "object",
                    "properties": {
                        "account": {
                            "$ref": "#/components/schemas/AccountReference"
                        }
                    }
                }
            ],
            "required": [
                "account"
            ]
        },
        "Limit": {
            "type": "object",
            "properties": {
                "region": {
                    "$ref": "#/components/schemas/Region"
                },
                "paymentProduct": {
                    "$ref": "#/components/schemas/PaymentProduct"
                },
                "type": {
                    "$ref": "#/components/schemas/Type"
                },
                "value": {
                    "$ref": "#/components/schemas/Amount"
                }
            },
            "required": [
                "region",
                "paymentProduct",
                "type",
                "value"
            ]
        },
        "AccountReference": {
            "type": "object",
            "properties": {
                "iban": {
                    "$ref": "#/components/schemas/Iban"
                },
                "currency": {
                    "$ref": "#/components/schemas/CurrencyCode"
                }
            },
            "required": [
                "iban",
                "currency"
            ]
        }
    }
}

Thanks for your help

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-0.5): Thanks for your help
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: BenjaminK