Skip to content

bnomei/kirby3-schema

Repository files navigation

Kirby JSON Schema

Release Checks Discord

JSON Schema file for Kirby blueprints

Commercial Usage


Support open source!

This schema file is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?

Be kind. Share a little. Thanks.

‐ Bruno
 
M O N E Y
Github sponsor Patreon Buy Me a Coffee Paypal dontation Hire me

Install

Schemastore (not yet)

Ideally the schema of this repo would be available from the Schemastore and it would be almost zero configuration in most IDEs. But that is something the Kirby CMS team should do eventually, not me.

Manual IDE configuration

VSCode

You will need the Red Hat VS Code YAML Extension and then you can use the yaml.schemas setting to add your schema like this:

  "yaml.schemas": {
    "/path/to/your/schema/kirby4-blueprints.schema.json": "site/blueprints/**/*.yml"
  }

This will automatically use the schema for all blueprint files.

The extension prepends / on the path so its /~/YOUR_FOLDER/kirby3-schema/kirby4-blueprints.schema.json.

thanks @tobimori and @iskrisis

PHP Storm

Clone this repo to your local machine. Open the IDE settings and search for JSON Schema. Then select Languages & Frameworks » Schemas and DTDs » JSON Schema Mappings. Click the + button at the top to add a new JSON validate configuration. Then fill in the corresponding name, file or URL, and version.

For testing I mapped it to my site/blueprints folder.

Sublime Text

You can use the schema in Sublime Text by cloning this repo to your local machine and setting a custom JSON schema location using [this Sublime Text extension](https://github.com/sublimelsp/LSP-json?tab=readme-ov-file#custom-schemas and wildcards in fileMatch schema settings (more].

Blueprint detection

Since Kirby reuses some types like file, info, pages in fields and sections the schema can not always determine which blueprint you are working on with absolute certainty. For now, I introduced a blueprint property to solve this. Use it in your file, page, user and site blueprints.

+ blueprint: site

title: My Site Blueprint

fields:
  text:
    type: text
+ blueprint: page

title: My Page Blueprint

fields:
  text:
    type: text

Disclaimer

This schema is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this schema in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.