Skip to content

feat(symfony): deprecate jsonapi.use_iri_as_id defaulting to true#8327

Open
soyuka wants to merge 4 commits into
api-platform:mainfrom
soyuka:feat/deprecate-jsonapi-use-iri-as-id
Open

feat(symfony): deprecate jsonapi.use_iri_as_id defaulting to true#8327
soyuka wants to merge 4 commits into
api-platform:mainfrom
soyuka:feat/deprecate-jsonapi-use-iri-as-id

Conversation

@soyuka

@soyuka soyuka commented Jun 17, 2026

Copy link
Copy Markdown
Member

What

Deprecate relying on the implicit true default of api_platform.jsonapi.use_iri_as_id (4.4). The default will flip to false in 5.0.

How

  • Configuration: use_iri_as_id node defaultTrue()defaultNull(), so the extension can distinguish unset from an explicit true/false. Removed the // TODO 4.4 marker; info() text notes the upcoming 5.0 default change.
  • ApiPlatformExtension::registerJsonApiConfiguration(): when the resolved value is null (unset), emit a 4.4 trigger_deprecation and coerce to true — runtime behavior is unchanged. Explicit true/false pass through with no deprecation.
  • Added api-platform/json-api to src/Symfony require-dev so the gated jsonapi extension path is reachable in the standalone component suite.

Deprecation message

Not setting "api_platform.jsonapi.use_iri_as_id" explicitly is deprecated. Its default value will change from "true" to "false" in API Platform 5.0. Set it to "true" to keep the current behavior or to "false" to use entity identifiers as the "id" field, and silence this deprecation.

BC

Zero BC break — additive deprecation only. Implicit true is preserved at runtime.

Tests

New JsonApiUseIriAsIdDeprecationTest (component suite, #[Group('legacy')] + #[IgnoreDeprecations]): unset → deprecation fires + resolves true; explicit false → no deprecation + resolves false; explicit true → no deprecation + resolves true. Green under --fail-on-deprecation.

soyuka added 4 commits May 19, 2026 16:37
Allows defining JSON-LD namespace prefix entries (e.g. `dct:
http://purl.org/dc/terms/`) directly on ApiResource/HttpOperation,
which get merged into the generated `@context` output.

Closes api-platform#767
The "api_platform.jsonapi.use_iri_as_id" option now defaults to null so
the extension can tell an unset value from an explicit one. When unset, a
4.4 deprecation is triggered and the value is coerced to true, preserving
current behavior. The default will change to false in 5.0.

Set the option explicitly to true or false to silence the deprecation.
…0d2ea776066d1

# Conflicts:
#	src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php
Config processing now returns null (default_null); the true
coercion happens in the extension. Companion to the deprecation
in this PR.
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.

1 participant