quanta + properties

This commit is contained in:
JMARyA 2025-05-18 22:30:18 +02:00
parent 91d39a4d83
commit 16353c7683
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
8 changed files with 123 additions and 86 deletions

View file

@ -87,3 +87,41 @@ variants:
needs:
temperature: [5.0, 10.0]
```
### Quantization
Sometimes items are homogenous and can be subdivided.
This can be defined via the `unit` of an Item Variant.
You define the base unit (the smallest possible instance) of an Item Variant. In this case `ml`.
Optionally you can define various `conversions` to bigger units by specifiying the units name and how many of the base unit this unit is.
In this case we define `liter` to be 1000 `ml`.
```yml
name: "Water"
variants:
regular:
name: "Regular Water"
unit:
by: "ml"
conversions:
liter: 1000
```
### Properties
Some items might be more or less the same thing but come in various configurations.
To address such items you can define custom properties on Item Variants.
You can then use these properties to save and filter on metadata about your items.
This can be done by defining custom properties in a JSON schema like format in `properties`:
```yml
name: "iPhone"
variants:
iphone:
name: "iPhone"
properties:
color:
enum: ["Black", "White", "Red"]
description: "The Phone Color"
ram:
type: integer
description: "The amount of RAM"
```