Skip to content

Schema incorrectly requires 'type' property when using 'extends' #37

@MichaelvanLaar

Description

@MichaelvanLaar

Issue Description

The JSON schema incorrectly marks the type property as required for all field definitions, even when the extends property is used. This causes false validation warnings in editors when following the official Kirby documentation.

Expected Behavior

According to the official Kirby documentation on extending blueprints, when using the extends property, the type property should be omitted because it is inherited from the referenced field:

starters:
  extends: fields/dishes
  label: Starters  # Override properties, but NO 'type' needed

Current Behavior

The schema defines all field types with "required": ["type"], which causes validation warnings when correctly using extends without type.

Example from the schema (both Kirby 4 and 5 versions):

"blocks": {
  "required": [
    "type"
  ],
  "additionalProperties": false,
  "properties": {
    "type": {
      "enum": ["blocks"]
    },
    "extends": {
      "$ref": "#/$defs/field-properties/@extends"
    },
    // ... other properties
  }
}

Impact

  • Developers following official Kirby documentation get false validation warnings
  • This affects all field types in both kirby4-blueprints.schema.json and kirby5-blueprints.schema.json
  • Blueprints work correctly in Kirby, but editors show incorrect errors

Suggested Fix

Use JSON Schema conditional logic to make type required only when extends is NOT present:

{
  "if": {
    "not": { "required": ["extends"] }
  },
  "then": {
    "required": ["type"]
  }
}

Or use anyOf to allow either pattern:

{
  "anyOf": [
    { "required": ["type"] },
    { "required": ["extends"] }
  ]
}

Verification

This issue was discovered while testing the vscode-kirby-toolkit extension, which bundles this schema for Blueprint validation. The issue appears in both the Kirby 4 and Kirby 5 versions of the schema.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions