/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/

Comments

e0ipso created an issue. See original summary.

symbioquine’s picture

Version: » 8.x-1.0-beta1
StatusFileSize
new99.77 KB
new47.3 KB

I'm seeing a potentially related issue with the third_party_settings schema where the type is present, but is "array" where is should be "object"...

asset_types

asset_type_schema

Given /api/asset_type/asset_type & /api/asset_type/asset_type/resource/schema respectively.

wim leers’s picture

For me, /jsonapi/block/block/resource/schema produces:

…
        "third_party_settings": {
          "type": "array",
          "items": {
            "properties": {
              "third_party_settings": {
                "title": "third_party_settings"
              }
            }
          }
        },
…

— just like for @Symbioquine it seems.

m.stenta’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
StatusFileSize
new62.78 KB

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):

/jsonapi/user/user/resource/schema screenshot

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.

m.stenta’s picture

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.

m.stenta’s picture

Issue tags: +Needs tests

We have automated tests now (#3257911: Add basic test coverage) so it would be good to include a test to demonstrate this issue and prevent regressions.