Json API explorer not working

Created on 14 December 2022, over 2 years ago
Updated 20 May 2025, 24 days ago

Problem/Motivation

After updated modules about Json:API, explorer not working anymore.

After some search, I fixed the first visible error with the patch in this issue : TypeError: Argument 1 passed to JsonApiSchemaController πŸ› TypeError: Argument 1 passed to Drupal\jsonapi_schema\Controller\JsonApiSchemaController::Drupal\jsonapi_schema\Controller\{closure}() must be an instance of Drupal\jsonapi\ResourceType\ResourceType RTBC

But after applied the patch, explorer still not working. I see in the production website (not already push the update module) the explorer call one time the /jsonapi/schema url. And after update I see more than 300 calls for schemas.

The main difference is in "targetSchema" attribute :
before

"type": "object",
"links": [
  {
    "href": "{instanceHref}",
    "rel": "related",
    "title": "Platform entities",
    "targetMediaType": "application/vnd.api+json",
    "targetSchema": "https://xxxx/jsonapi/platform/platform/collection/schema",
    "templatePointers": {
      "instanceHref": "/links/platform--platform/href"
    },
    "templateRequired": [
      "instanceHref"
    ]
  },
...

And after update

"type": "object",
"links": [
  {
    "href": "{instanceHref}",
    "rel": "related",
    "title": "Platform entities",
    "targetMediaType": "application/vnd.api+json",
    "targetSchema": {
      "$ref": "https://xxxx/jsonapi/platform/platform/collection/schema"
    },
    "templatePointers": {
      "instanceHref": "/links/platform--platform/href"
    },
    "templateRequired": [
      "instanceHref"
    ]
  },
...

Proposed resolution

I propose you an patch quick-fix to prevent this issue.

But, with more background whole feature/project the patch isn't the correct solution.

πŸ› Bug report
Status

Needs work

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium niknak Godarville, πŸ‡§πŸ‡ͺ

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024