Config entities carry invalid object definitions

Created on 1 June 2019, almost 6 years ago
Updated 14 May 2025, about 4 hours ago

/jsonapi/block/block/resource/schema.json

Produces the following output:

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://vanilla-drupal.local/en/jsonapi/block/block/resource/schema.json?XDEBUG_SESSION_START=PHPSTORM",
    "allOf": [
        {
            "type": "object",
            "properties": {
                "attributes": {
                    "$ref": "#/definitions/attributes"
                },
                "relationships": {
                    "$ref": "#/definitions/relationships"
                }
            }
        },
        {
            "$ref": "https://jsonapi.org/schema#/definitions/resource"
        }
    ],
    "properties": {
        "attributes": {
            "$ref": "#/definitions/attributes"
        }
    },
    "definitions": {
        "langcode": {
            "type": "string"
        },
        "status": {
            "type": "boolean"
        },
        "dependencies": [],
        "attributes": {
            "description": "Entity attributes",
            "type": "object",
            "properties": {
                "third_party_settings": {
                    "properties": {
                        "third_party_settings": []
                    }
                },
                "visibility": {
                    "properties": {
                        "visibility": []
                    }
                }
            },
            "additionalProperties": false
        },
        "drupal_internal__id": {
            "type": "string"
        },
        "theme": {
            "type": "string"
        },
        "region": {
            "type": "string"
        },
        "weight": {
            "type": "integer"
        },
        "provider": {
            "type": "string"
        },
        "plugin": {
            "type": "string"
        },
        "settings": []
    }
}

Note that:

  1. definitions/attributes/properties/third_party_settings is missing "type": "object"
  2. Some of the properties like: langcode, theme, region, … are incorrectly under definitions/<code> and they should be under <code>definitions/attributes/properties/
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

e0ipso Can Picafort

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡ΊπŸ‡ΈUnited States m.stenta

    definitions/attributes/properties/third_party_settings is missing "type": "object"

    @symbioquine and @wimleers are correct: type is no longer missing, but it is not correct. It should be object instead of array.

    I am noticing a similar issue in definitions/relationships/properties/roles/properties/data in the /jsonapi/user/user/resource/schema endpoint (which is not a config entity resource type, but relates to one):

    Notice how it declares "type": "array" instead of object, and includes an items array. Just like in the third_party_settings example.

    This does feel related to #3324824: Schema incorrect for config entity "fields" that are Maps and Sequences β†’ as @wimleers pointed out ( https://www.drupal.org/project/jsonapi_schema/issues/3324824#comment-148... β†’ ). I wonder if we should close this as "outdated" and work on fixing config entity normalization generally over there.

    2. Some of the properties like: langcode, theme, region, … are incorrectly under definitions and they should be under definitions/attributes/properties/

    This appears to be resolved in 8.x-1.x. Not sure when it was fixed, but they are all under definitions/attributes/properties/ now.

  • πŸ‡ΊπŸ‡ΈUnited States m.stenta

    I am noticing a similar issue in definitions/relationships/properties/roles/properties/data in the /jsonapi/user/user/resource/schema endpoint (which is not a config entity resource type, but relates to one):

    Nevermind, this is supposed to be an array because it's describing a list of all the roles the user has.

Production build 0.71.5 2024