Skip to content

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

Merged
soyuka merged 3 commits into
api-platform:mainfrom
soyuka:feat/deprecate-jsonapi-use-iri-as-id
Jun 22, 2026
Merged

feat(symfony): deprecate jsonapi.use_iri_as_id defaulting to true#8327
soyuka merged 3 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 3 commits June 22, 2026 10:40
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.
Config processing now returns null (default_null); the true
coercion happens in the extension. Companion to the deprecation
in this PR.
…nfig

The 4.4 deprecation for an unset "api_platform.jsonapi.use_iri_as_id"
fires throughout the functional suite, failing the "no deprecations" and
"Symfony dev" CI jobs (run with max[self]=0). Set it to true in
config_common.yml to preserve the current default behavior and silence
the self-inflicted deprecation. The intentional deprecation assertions
live in JsonApiUseIriAsIdDeprecationTest (#[Group('legacy')]).
@soyuka soyuka force-pushed the feat/deprecate-jsonapi-use-iri-as-id branch from 2288686 to 30db497 Compare June 22, 2026 08:51
@soyuka soyuka merged commit 8f48b9d into api-platform:main Jun 22, 2026
84 of 97 checks passed
@soyuka soyuka deleted the feat/deprecate-jsonapi-use-iri-as-id branch June 22, 2026 09:09
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