JSON Schema — the .meb standard
Status:
[x]ready — version 3.0.0
The formal validation schema of a .meb file, compliant with the JSON Schema Draft 2020-12 standard.
Files
meb.schema.json— the.mebfile schema in the current version (3.0.0){version}/meb.schema.json— schemas of the individual versions:1.0.0,1.1.0,1.2.0,2.0.0,2.1.0,2.2.0,2.3.0,2.4.0,2.5.0,2.6.0,3.0.0
What the schema validates
- Required fields at every nesting level
- Primitive types (
string,number,boolean,array,object) - Enumerated values (enums) — all fields with a predefined list of values
- Numeric ranges — dimensions (
> 0), angles, quantities, application order - Conditional fields — e.g.
drilling.facerequired whentype: "face",material.sheetrequired whencategory: "board" - The format of
meta.version(semver) andmeta.checksum(sha256) - Vendor extensions —
x_*fields allowed everywhere, other unknown fields rejected
What the schema does not validate
The schema is structural — it cannot verify dependencies between lists. The following rules require validation on the application side:
| Rule | Where described |
|---|---|
Referential integrity — every *_ref must point to an existing id | spec §15.2 |
Uniqueness of id within a collection | spec §15.1 |
| Polyhedron face loops: consecutive vertices connected by an edge, the face planar, holes inside the outline | spec §15.9 |
| A panel belongs to at most one grain group | spec §15.4 |
| Panels in a grain group use the same material | spec §15.4 |
Grain group rows (row) form a continuous sequence 1…n, and positions in a row (order) — 1…m without repetitions | spec §15.4 |
| Panels of a grain group row have the same dimension along the grain | spec §15.4 |
| A panel fits within the dimensions of the material sheet | spec §15.5 |
| A grain group block fits on the sheet along and across the grain | spec §15.4 |
edging.sequence ∈ {width_first, length_first} | spec §8.5 |
An edge does not have both edging and edge_finish | spec §15.8 |
A wall does not appear in both edging.walls and edge_finish.walls | spec §15.8 |
2 × edge_finish.chamfer < dimensions.thickness | spec §15.8 |
Uniqueness of hardware_instance.id and of the id of cabinet solids | spec §15.1 |
extrusion holes inside the outline and without mutual intersections | spec §15.9 |
Length of positions and triangles a multiple of 3, indices within the mesh range | spec §15.9 |
hardware_instance_ref points to a hardware item with a position | spec §15.9 |
How to use
Validation (CLI)
bash
# ajv-cli (Node.js)
npm install -g ajv-cli
ajv validate -s schema/meb.schema.json -d plik.meb
# jsonschema (Python)
pip install jsonschema
jsonschema -i plik.meb schema/meb.schema.jsonValidation in PHP
php
composer require opis/json-schema
$validator = new \Opis\JsonSchema\Validator();
$schema = \Opis\JsonSchema\Schema::fromJsonString(
file_get_contents('schema/meb.schema.json')
);
$result = $validator->validate(
json_decode(file_get_contents('plik.meb')),
$schema
);Autocompletion in VSCode
Add to .vscode/settings.json:
json
{
"json.schemas": [
{
"fileMatch": ["*.meb"],
"url": "./schema/meb.schema.json"
}
]
}Schema versioning
The schema is versioned together with the standard. The $id field contains the version:
https://meb.org.pl/schema/3.0.0/meb.schema.jsonWith every MINOR or MAJOR change of the standard, a new version of the schema is published under a new URL.