Giter VIP home page Giter VIP logo

shel.neos.schema's Introduction

JSON schema for Neos CMS nodetypes

Tests

This repository contains a JSON schema, that can be used in PHPStorm or VSCode to get

  • autocompletion
  • typehints
  • validation of Neos CMS nodetypes files
  • inline documentation

Example usage in PHPStorm

When the schema is stable enough it will hopefully be made available in the schema store.

The schema is based on the old YAML schemas we already have in Neos & Flow. But they all need some converting and can be updated with the latest functionality of what JSON schema can do. With a bit of community effort we can upgrade them, put them in the core, replace our own schema validator and make the schemas officially available on https://www.schemastore.org/json/. The schemastore allows your IDE to automatically download the one your need.

Features:

Autocompletion

In addition to usual fields there are also conditional schema definitions for the following properties:

  • editor (due to a bug in IntelliJ, autocompletion doesn't show the matching editorOptions but validation works)
  • validation

Typehints

Typehints for all known Neos core nodetype properties.

Validation

You can run validations against your nodetypes with Ajv or similar. See test.js for an example.

Inline docs

This is still work-in-progress and only a few entries properties have full documentation. Feel free to open a PR to add more. We support the fields title, description and x-intellij-html-description for html docs.

How to use

PHPStorm / IntelliJ IDEA

Follow the official instruction and add the url:

https://raw.githubusercontent.com/Sebobo/Shel.Neos.Schema/main/NodeTypes.Schema.json

Make sure there is no space at the end of the url when pasting it into your IDE or the Schema will not validate.

Set Schema Version to JSON Schema version 7.

Add path mappings to the packages you work on. For example:

DistributionPackages/*/Configuration/NodeTypes*.yaml

Other editors

Visual Studio Code and other editors also support JSON schema. Instructions are easy to find with your favourite search engine.

Schema variants

Certain declarations in a NodeTypes.yaml file are valid but not considered as "best practise". The default schema mentioned in the instructions above will not enforce those.

Strict schema

If you want additional strict validation, you can instead use the strict schema with the url:

https://raw.githubusercontent.com/Sebobo/Shel.Neos.Schema/main/NodeTypes.Schema.Strict.json

Implemented additional checks:

  • Only 1 nodetype per file

FAQ

I get duplicate results for autocompletion

This happens when you have the Neos plugin installed in an IntelliJ IDE. The plugin also provides some basic autocompletion hints.

The developer of the plugin plans to use this schema in the future instead. Then the duplicates will disappear.

Contribution

If you know how to use the schema in other editors, please provide a PR with the instructions.

If you have ideas on how to improve the schema, please provide an issue with an example, and a PR that would resolve the issue if you can.

shel.neos.schema's People

Contributors

prgfx avatar sebobo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.