Skip to content

feat(jsonapi)!: default use_iri_as_id to false - #8512

Merged
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/jsonapi-use-iri-as-id-default-false
Sep 11, 2026
Merged

feat(jsonapi)!: default use_iri_as_id to false#8512
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/jsonapi-use-iri-as-id-default-false

Conversation

@Maxcastel

@Maxcastel Maxcastel commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
Q A
Branch? main
Tickets #8327
License MIT
Doc PR api-platform/docs#...

Summary

Follows up on the deprecation introduced in #8327, which announced this change for 5.0:

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.

api_platform.jsonapi.use_iri_as_id now defaults to false instead of resolving to true with a deprecation. The id member carries the resource identifier and the IRI moves to links.self, which is where JSON:API conventionally expects a resource URL.

Before

{
  "data": {
    "id": "/books/10",
    "type": "Book" 
   }
}

After

{
  "data": {
    "id": "10",
    "type": "Book",
    "links": { "self": "/books/10" }
  }
}

Keeping the previous behavior

Symfony

api_platform:
    jsonapi:
        use_iri_as_id: true

Laravel

'jsonapi' => [
    'use_iri_as_id' => true,
],

Changes

  • Configuration: use_iri_as_id is defaultFalse() instead of defaultNull()
  • ApiPlatformExtension: drops the 4.4 deprecation and the true fallback
  • Laravel: the published config default and the provider fallback both become false, so both integrations agree
  • JsonApiUseIriAsIdDeprecationTest is renamed to JsonApiUseIriAsIdTest and now asserts that an unset option resolves to false
  • The suites that assert IRIs in data.id (config_common.yml on the Symfony side, JsonApiTest on the Laravel side) now set use_iri_as_id: true explicitly, so both modes stay covered: IriModeTest for true, IdentifierModeTest (the jsonapi environment) for the new default

BC break

Apps that never set the option explicitly will see JSON:API data.id change from the IRI to the scalar identifier. Setting use_iri_as_id: true restores the old payload.

@Maxcastel
Maxcastel force-pushed the feat/jsonapi-use-iri-as-id-default-false branch from 62280d4 to 2963b38 Compare September 8, 2026 13:28
@Maxcastel Maxcastel changed the title feat!(jsonapi): default use_iri_as_id to false feat(jsonapi)!: default use_iri_as_id to false Sep 8, 2026
@Maxcastel
Maxcastel force-pushed the feat/jsonapi-use-iri-as-id-default-false branch from 2963b38 to 8254e07 Compare September 8, 2026 13:37
@soyuka
soyuka merged commit 14ce743 into api-platform:main Sep 11, 2026
4 of 111 checks passed
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.

2 participants