Tuple schemas no longer emit additionalItems. Homogeneous unions now serialize as OpenAPI 3.1 type arrays instead of anyOf.
What's Changed
🚨 Breaking changes 🚨
- Remove unsupported
additionalItemsfrom array schemas by @romalytvynenko in #1264
additionalItems existed in older JSON Schema drafts. OpenAPI 3.1 uses JSON Schema 2020-12, where that keyword is gone — extra items after prefixItems are controlled by items instead.
Scramble was emitting additionalItems: false on fixed-length array / tuple schemas (prefixItems plus minItems / maxItems). Validators such as Redocly rejected the document: Property additionalItems is not expected here.
Tuple length is already pinned with minItems / maxItems, so the extra keyword was both invalid and redundant. It is omitted rather than replaced with items: false.
The generated spec will no longer contain additionalItems. ArrayType::setAdditionalItems() is also gone. This is very unlikely to affect you unless a client or linter depended on that keyword, or you called the setter yourself.
- Optimize homogeneous union schemas into type arrays by @romalytvynenko in #1269
Unions whose branches are only types (string|int, int|float|string, unconstrained array|string, …) now serialize as a type array instead of anyOf:
{ "type": ["string", "integer"] }instead of
{ "anyOf": [{ "type": "string" }, { "type": "integer" }] }anyOf is kept when a branch has extra keywords (enum, const, …). integer is dropped when number is present (JSON Schema: integer is a subset of number), so int|float becomes { "type": "number" }. Empty items: {} on unconstrained arrays is omitted so they can fold into the same form.
This is valid OpenAPI 3.1 and usually renders the same in the UI, but generated clients may change if they treated anyOf and type arrays differently.
Added
- Infer arithmetic, string concatenation, and
cloneinstead of documenting them asstringby @romalytvynenko in #1267
Unknown operands are treated as numeric (int|float) rather than unknown/string. + also documents array union ($a + [] → array). Impossible arithmetic (1 + []) is never. Concat of mixed values keeps enough of the template to guess download MIME from the extension.
Changes
- Stop treating plain comments above
returnas response descriptions — only explicit@description,@status, and@bodyapply by @yugarinn in #1254 - Serialize string-like
| nullunions as a nullable string (type: ["string", "null"]) instead ofanyOf
Fixes
- Handle unpacked and implicit array keys in schemas by @romalytvynenko in #1266
- Fix object type acceptance to respect class hierarchy by @romalytvynenko in #1265
- Preserve PHPDoc types while refining inferred model attributes by @romalytvynenko in #1263
- Fix type refining so declared types keep their shape while picking up inferred details (formats, generics, array shapes) by @romalytvynenko in #1268
- Fix JSON resource model guessing and analyze vendor resource bodies by @romalytvynenko in #1260
- Document
paginate()onmixedas a paginator - Bind native
selfreturn types to the receiver so chained setters keep their generic
New Contributors
Full Changelog: v0.13.42...v0.13.43