Schema incorrect for config entity "fields" that are Maps and Sequences

Created on 1 December 2022, over 2 years ago
Updated 20 May 2025, 3 days ago

Problem/Motivation

Discovered while working on https://www.drupal.org/project/field_ui_modern .

For example:

{
  "$schema": "https://json-schema.org/draft/2019-09/hyper-schema",
  "$id": "http://core.test/jsonapi/field_storage_config/field_storage_config/resource/schema",
  "title": "Field storage",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/type"
        },
        "attributes": {
          "$ref": "#/definitions/attributes"
        }
      }
    },
    {
      "$ref": "https://jsonapi.org/schema#/definitions/resource"
    }
  ],
  "definitions": {
    "type": {
      "const": "field_storage_config--field_storage_config"
    },
    "attributes": {
      "properties": {
        "drupal_internal__id": {
          "type": "string",
          "title": "drupal_internal__id"
        },
        "langcode": {
          "type": "string",
          "title": "langcode"
        },
        "status": {
          "type": "boolean",
          "title": "status"
        },
        "dependencies": {
          "title": "dependencies"
        },
        "third_party_settings": {
          "type": "array",
          "items": {
            "properties": {
              "third_party_settings": {
                "title": "third_party_settings"
              }
            }
          }
        },
        "field_name": {
          "type": "string",
          "title": "field_name"
        },
        "entity_type": {
          "type": "string",
          "title": "entity_type"
        },
        "field_storage_config_type": {
          "type": "string",
          "title": "field_storage_config_type"
        },
        "settings": {
          "title": "settings"
        },
        "module": {
          "type": "string",
          "title": "module"
        },
        "locked": {
          "type": "boolean",
          "title": "locked"
        },
        "cardinality": {
          "type": "integer",
          "title": "cardinality"
        },
        "translatable": {
          "type": "boolean",
          "title": "translatable"
        },
        "indexes": {
          "type": "array",
          "items": {
            "properties": {
              "indexes": {
                "title": "indexes"
              }
            }
          }
        },
        "persist_with_no_fields": {
          "type": "boolean",
          "title": "persist_with_no_fields"
        },
        "custom_storage": {
          "type": "boolean",
          "title": "custom_storage"
        }
      },
      "description": "Entity attributes",
      "type": "object",
      "additionalProperties": false
    }
  }
}

→ note how

        "dependencies": {
          "title": "dependencies"
        },

does not specify any type — it should be a type: object, with the potential keys being module, theme, config and content.

Same for other "fields" (top-level properties) like settings — although that one is field-type-specific, which I'm not sure how we can express in JSON Schema.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

  • 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