Additional properties are too restrictive (OpenAPI 3.0)

An additional-property restriction rejects fields that the API should allow

Description

In a composed OpenAPI 3.0 schema, additionalProperties: false can reject a field defined in another allOf branch.

Potential impact

A valid request or response can fail validation when one branch treats an expected field as unknown.

Remediation

Check which fields each branch must accept. Declare those fields in the closed schema or revise the composition. Allow extension fields only where the API needs them, and constrain their values if appropriate.

Examples

This oneOf excerpt omits info and paths. Keep MyObject closed if id and name are its only fields. Both oneOf and anyOf allow a closed schema.

Before

json
{
  "openapi": "3.0.0",
  "components": {
    "schemas": {
      "MyObject": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "name": { "type": "string" }
            },
            "additionalProperties": false
          }
        ]
      }
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "components": {
    "schemas": {
      "MyObject": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "name": { "type": "string" }
            },
            "additionalProperties": true
          }
        ]
      }
    }
  }
}

References