Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bnomei/kirby3-schema

JSON Schema file for Kirby 3 and 4 Blueprints
https://github.com/bnomei/kirby3-schema

autocompletion blueprint json-schema kirby kirby-cms phpstorm validation vscode yaml

Last synced: 4 days ago
JSON representation

JSON Schema file for Kirby 3 and 4 Blueprints

Awesome Lists containing this project

README

        

# Kirby 3 and 4 Schema

![Release](https://flat.badgen.net/github/release/bnomei/kirby3-schema?color=ae81ff)
![Checks](https://flat.badgen.net//github/checks/bnomei/kirby3-schema)
[![Discord](https://flat.badgen.net/badge/discord/bnomei?color=7289da)](https://discordapp.com/users/bnomei)

JSON Schema file for Kirby 3 and 4 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](https://github.com/sponsors/bnomei) | [Patreon](https://patreon.com/bnomei) | [Buy Me a Coffee](https://buymeacoff.ee/bnomei) | [Paypal dontation](https://www.paypal.me/bnomei/15) | [Hire me](mailto:[email protected]?subject=Kirby) |

## Install

### Schemastore (not yet)

Ideally the schema of this repo would be available from the [Schemastore](https://www.schemastore.org/json/) and it would be almost zero configuration in most IDEs. But that is something the Kirby 3 CMS team should do eventually, not me.

### Manual IDE configuration

#### VSCode

You will need the [Red Hat VS Code YAML Extension](https://github.com/redhat-developer/vscode-yaml) and then you can use the `yaml.schemas` setting to add your schema like this:

```yaml
"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](https://github.com/sublimelsp/LSP-yaml) and wildcards in `fileMatch` [schema settings](https://github.com/sublimelsp/LSP-yaml/blob/7b928a7b84f25381b01fa98c04ca7b1418b3a465/LSP-yaml.sublime-settings#L37) ([more](https://github.com/sublimelsp/LSP-json?tab=readme-ov-file#custom-schemas)].

### 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.

```diff
+ blueprint: site

title: My Site Blueprint

fields:
text:
type: text
```

```diff
+ 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](https://github.com/bnomei/kirby3-schema/issues/new).

## License

[MIT](https://opensource.org/licenses/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.