nhovratov / content-blocks-json-schema

1 stars 1 forks source link

JSON Schema for TYPO3 CMS Content Blocks

This repository contains JSON schemas for Content Elements, Page Types and Record Types from the Content Blocks extension. Using them in your IDE allows for auto-completion and validation of your EditorInterface.yaml files.

Setup

PhpStorm

  1. Open PhpStorm and switch to File > Preferences > Languages & Frameworks > Schemas and DTDs > JSON Schema Mappings
  2. Add new entry for Content Elements
    • Schema file or URL: https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/content-element.schema.json
    • File path Pattern: **/ContentBlocks/ContentElements/*/EditorInterface.yaml
  3. Add new entry for Page Types
    • Schema file or URL: https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/page-type.schema.json
    • File path Pattern: **/ContentBlocks/PageTypes/*/EditorInterface.yaml
  4. Add new entry for Record Types
    • Schema file or URL: https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/record-type.schema.json
    • File path Pattern: **/ContentBlocks/RecordTypes/*/EditorInterface.yaml

Visual Studio Code

  1. Install the plugin "redhat.vscode-yaml"
  2. Open the settings and search for "yaml schemas" and open the settings.json.
  3. Add the following config
"yaml.schemas": {
    "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/content-element.schema.json" : ["**/ContentBlocks/ContentElements/*/EditorInterface.yaml"],
    "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/page-type.schema.json" : ["**/ContentBlocks/PageTypes/*/EditorInterface.yaml"],
    "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/record-type.schema.json" : ["**/ContentBlocks/RecordTypes/*/EditorInterface.yaml"]
}

A basic configuration.json looks like this

{
    "explorer.confirmDelete": false,
    "window.zoomLevel": 1,
    "security.workspace.trust.untrustedFiles": "open",
    "yaml.schemas": {
       "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/content-element.schema.json" : ["**/ContentBlocks/ContentElements/*/EditorInterface.yaml"],
       "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/page-type.schema.json" : ["**/ContentBlocks/PageTypes/*/EditorInterface.yaml"],
       "https://raw.githubusercontent.com/nhovratov/content-blocks-json-schema/main/record-type.schema.json" : ["**/ContentBlocks/RecordTypes/*/EditorInterface.yaml"]
    }
}