php-sdk/tests/Unit
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Björn Meyer 9236824b6d
[Schema] Always emit {} for empty tool schema properties (#407)
* [Schema] Always emit {} for empty tool schema properties

Normalize empty properties arrays (including nested object schemas and
outputSchema) in Tool::__construct so tools/list never serializes
invalid JSON Schema properties: [].

Fixes #405

* [Schema] Normalize every empty sub-schema, not only properties

Walking into `items` and `additionalProperties` without normalizing an empty
sub-schema at those positions left the `[]`-instead-of-`{}` bug intact one
level down. Most notably it regressed #151 on a `Tool::fromArray()`
round-trip: `SchemaGenerator` emits `items: {}` for untyped array parameters,
which decodes to `[]` and was re-serialized as `[]` — the exact schema strict
clients reject.

Empty sub-schemas are now replaced with a `\stdClass` at every schema
position, and the keyword list is completed to cover draft-07 through
2020-12: `$defs`, `definitions`, `dependentSchemas`, `patternProperties`,
`propertyNames`, `contains`, `not`, `if`/`then`/`else`, `additionalItems`,
and `unevaluatedItems`/`unevaluatedProperties`. Keywords holding plain JSON
arrays (`allOf: []`, `enum: []`, `dependentRequired`) keep encoding as `[]`.

---------

Co-authored-by: Christopher Hertel <mail@christopher-hertel.de>
2026-08-14 21:50:08 +02:00
..
Capability [Server] Always emit items for array tool parameter schemas (#378) 2026-07-14 23:56:50 +02:00
Client [Client] Reject non-positive timeouts in Configuration (#415) 2026-08-14 08:22:20 +02:00
Fixtures/Enum Split testsuite for unit and inspector based tests (#82) 2025-09-25 22:27:41 +01:00
JsonRpc [Client] Add client-side elicitation support (#371) 2026-07-14 23:55:06 +02:00
Schema [Schema] Always emit {} for empty tool schema properties (#407) 2026-08-14 21:50:08 +02:00
Server [Server] Throw the SDK's own RuntimeException from FileSessionStore (#404) 2026-08-14 21:29:26 +02:00
ServerTest.php Update codestyle based on updated Symfony rules (#229) 2026-02-01 11:54:31 +01:00