Skip to content

fix(jsonapi): declare type: object on JSON:API resource schemas - #8724

Merged
soyuka merged 2 commits into
api-platform:5.0from
ousamabenyounes:fix/issue-8701
Nov 3, 2026
Merged

soyuka merged 2 commits into
api-platform:5.0from
ousamabenyounes:fix/issue-8701

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
Tickets Closes #8701
License MIT

JSON:API resource schemas were emitted with properties but no type, so a
consumer validating against them could not tell the schema describes an object.

The test, on 5.0 without the two-line fix:

1) ApiPlatform\JsonApi\Tests\JsonSchema\SchemaFactoryTest::testHasRootDefinitionKeyBuildSchema
Failed asserting that null is identical to 'object'.
2) ApiPlatform\JsonApi\Tests\JsonSchema\SchemaFactoryTest::testPostInputSchemaDoesNotRequireId
Failed asserting that null is identical to 'object'.
3) ApiPlatform\JsonApi\Tests\JsonSchema\SchemaFactoryTest::testErrorSchemaIsAnObject
Failed asserting that null is identical to 'object'.

Tests: 11, Assertions: 50, Failures: 3.

With the fix:

OK (11 tests, 56 assertions)

src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php carries the assertions;
testErrorSchemaIsAnObject is new and covers the error schema path from #8701.

@ousamabenyounes ousamabenyounes changed the title fix: JSON:API: resource schemas (*.jsonapi) have properties but no `typ fix(jsonapi): declare type: object on JSON:API resource schemas Oct 16, 2026
@ousamabenyounes
ousamabenyounes changed the base branch from main to 5.0 October 16, 2026 22:37
# Conflicts:
#	src/JsonApi/JsonSchema/SchemaFactory.php
#	src/JsonApi/Tests/JsonSchema/SchemaFactoryTest.php
@soyuka
soyuka merged commit ac7de64 into api-platform:5.0 Nov 3, 2026
117 checks passed
@soyuka

soyuka commented Nov 3, 2026

Copy link
Copy Markdown
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON:API: resource schemas (*.jsonapi) have properties but no type: object

2 participants