fix(jsonapi): declare type: object on JSON:API resource schemas by ousamabenyounes · Pull Request #8724 · api-platform/core · GitHub
Skip to content

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

Open
ousamabenyounes wants to merge 1 commit into
api-platform:5.0from
ousamabenyounes:fix/issue-8701
Open

ousamabenyounes wants to merge 1 commit 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
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

1 participant