Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: docs_src/media/adhesive_spec.pdf

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.9
rev: v0.14.5
hooks:
- id: ruff-format
1 change: 1 addition & 0 deletions data/aux_fields.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/fields.yaml
- key: 0
name: consumed_weight
type: number
Expand Down
1 change: 1 addition & 0 deletions data/config_nfcv.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/config.yaml
mime_type: application/vnd.openprinttag
root: nfcv
meta_fields: meta_fields.yaml
Expand Down
1 change: 1 addition & 0 deletions data/config_noroot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/config.yaml
mime_type: application/vnd.openprinttag
root: none
meta_fields: meta_fields.yaml
Expand Down
32 changes: 14 additions & 18 deletions data/main_fields.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/fields.yaml
- key: 0
name: instance_uuid
type: uuid
Expand Down Expand Up @@ -185,10 +186,8 @@

- key: 19
name: primary_color
type: bytes
max_length: 4
type: color_rgba
required: recommended
unit: "[R, G, B] or [R, G, B, A]"
example: "`\\xff\\x00\\x00\\x7f`"
description:
- Primary color of the material in the RGB(A) format, intended for UI purposes.
Expand All @@ -197,39 +196,29 @@

- key: 20
name: secondary_color_0
type: bytes
max_length: 4
unit: "[R, G, B] or [R, G, B, A]"
type: color_rgba
description:
- One of secondary colors of the material.
- Data format is the same as for `primary_color`.

- key: 21
name: secondary_color_1
type: bytes
max_length: 4
unit: "[R, G, B] or [R, G, B, A]"
type: color_rgba
description: See `secondary_color_0`.

- key: 22
name: secondary_color_2
type: bytes
max_length: 4
unit: "[R, G, B] or [R, G, B, A]"
type: color_rgba
description: See `secondary_color_0`.

- key: 23
name: secondary_color_3
type: bytes
max_length: 4
unit: "[R, G, B] or [R, G, B, A]"
type: color_rgba
description: See `secondary_color_0`.

- key: 24
name: secondary_color_4
type: bytes
max_length: 4
unit: "[R, G, B] or [R, G, B, A]"
type: color_rgba
description: See `secondary_color_0`.

- key: 25
Expand All @@ -256,6 +245,13 @@
required: recommended
description: Properties of the material. Can have multiple tags at once.

- key: 56
name: certifications
type: enum_array
items_file: material_certifications_enum.yaml
example: "`ul_2818`"
description: Certifications the material has.

- key: 29
name: density
type: number
Expand Down
12 changes: 12 additions & 0 deletions data/material_certifications_enum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- key: 0
name: ul_2818
display_name: UL 2818
description:
- GREENGUARD Certification Program For Chemical Emissions For Building Materials, Finishes And Furnishings.

- key: 1
name: ul_94_v0
display_name: UL 94 V0
description:
- Standard for Safety of Flammability of Plastic Materials for Parts in Devices and Appliances testing.
- Indicates a flame-retardant material.
1 change: 1 addition & 0 deletions data/material_class_enum.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/material_class_enum.yaml
- key: 0
name: FFF
description: Filament
Expand Down
1 change: 1 addition & 0 deletions data/material_type_enum.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/material_type_enum.yaml
- key: 0
abbreviation: PLA
name: Polylactic Acid
Expand Down
1 change: 1 addition & 0 deletions data/meta_fields.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=./schema/fields.yaml
- key: 0
name: main_region_offset
type: int
Expand Down
30 changes: 30 additions & 0 deletions data/schema/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$schema: "https://json-schema.org/draft-07/schema"
$id: "https://specs.openprinttag.org/schema/config.yaml"

title: Configuration root definition
description: Schema for OpenPrintTag configuration root definitions.

type: object
required: [ mime_type, meta_fields, main_fields ]
properties:
mime_type:
type: string
const: "application/vnd.openprinttag"
description: The mime type of the configuration.

root:
type: string
enum: [nfcv, none]
description: The root container of the OpenPrintTag.

meta_fields:
type: string
description: Path to the definitions of the Meta Section fields.

main_fields:
type: string
description: Path to the definitions of the Main Region fields.

aux_fields:
type: string
description: Path to the definitions of the Auxiliary Section fields.
116 changes: 116 additions & 0 deletions data/schema/fields.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
$schema: "https://json-schema.org/draft-07/schema"
$id: "https://specs.openprinttag.org/schema/fields.yaml"

title: Fields definition
description: Schema for OpenPrintTag section field definitions.

type: array
items:
oneOf:
- $ref: "#/definitions/deprecatedField"
- $ref: "#/definitions/basicField"
- $ref: "#/definitions/arrayField"
- $ref: "#/definitions/enumField"

definitions:
deprecatedField:
type: object
additionalProperties: false
description: Deprecated field.

required: [ key, deprecated ]

properties:
key:
type: integer
minimum: 0
description: Index of the field in CBOR.
deprecated:
type: boolean
const: true
description: Indicates that the field is deprecated.

baseField:
type: object
additionalProperties: false

required: [ key, type, name ]

not:
required: [ deprecated ]

properties:
key:
type: integer
minimum: 0
description: Identifier of the field in CBOR.
name:
type: string
pattern: "^[a-z0-9_]*$"
description: Name of the field.
unit:
type: string
description: Unit of measurement for the field.
example:
type: [ integer, number, string ]
description: Example value for the field.
required:
oneOf:
- type: boolean
- type: string
enum: [recommended]
description: Whether the field is required.
description:
oneOf:
- type: string
- type: array
items: { type: string }
description: Description of the field.
category:
type: string
description: Category of the field.

basicField:
allOf:
- $ref: "#/definitions/baseField"
- description: A basic value.

required: [ type ]

properties:
type:
type: string
enum: [ int, number, boolean, uuid, timestamp, color ]
description: Type of the field.

arrayField:
allOf:
- $ref: "#/definitions/baseField"
- description: An array of basic values.

required: [ type, max_length ]

properties:
type:
type: string
enum: [ bytes, string ]
description: Type of the field.
max_length:
type: integer
minimum: 1
description: Maximum number of elements in the array.

enumField:
allOf:
- $ref: "#/definitions/baseField"
description: An enumerated value.

required: [ items_file ]

properties:
type:
type: string
enum: [ enum, enum_array ]
items_file:
type: string
description: Path to the definition containing the list of enum values.
32 changes: 32 additions & 0 deletions data/schema/material_class_enum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$schema: "https://json-schema.org/draft-07/schema"
$id: "https://specs.openprinttag.org/schema/material_class_enum.yaml"

title: Material class variant definition
description: Schema for OpenPrintTag material class variant definitions.

type: array
items:
type: object
description: Material class variant.
additionalProperties: false

required: [ key, name ]

properties:
key:
type: integer
minimum: 0
description: Identifier of the material class in CBOR.
name:
type: string
pattern: "^[A-Z0-9_+-]*$"
description: Material class name.
description:
oneOf:
- type: string
- type: array
items: { type: string }
description: Description of the material class.
deprecated:
type: boolean
description: Whether the material class is deprecated.
41 changes: 41 additions & 0 deletions data/schema/material_type_enum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
$schema: "https://json-schema.org/draft-07/schema"
$id: "https://specs.openprinttag.org/schema/material_type_enum.yaml"

title: Material type variant definition
description: Schema for OpenPrintTag material type variant definitions.

type: array
items:
type: object
description: Material type variant.
additionalProperties: false

required: [ key, abbreviation, name, category ]

properties:
key:
type: integer
minimum: 0
description: Identifier of the material type in CBOR.
abbreviation:
type: string
pattern: "^[A-Z0-9_+-]*$"
description: Material type abbreviation.
name:
type: string
description: Human-readable material type name.
category:
type: string
pattern: "^[A-Z0-9_+-]*$"
description:
Material type category name.
See the `material_class` enum for valid categories.
description:
oneOf:
- type: string
- type: array
items: { type: string }
description: Description of the material class.
deprecated:
type: boolean
description: Whether the material class is deprecated.
29 changes: 29 additions & 0 deletions data/schema/tag_categories_enum.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$schema: "https://json-schema.org/draft-07/schema"
$id: "https://specs.openprinttag.org/schema/tag_category_enum.yaml"

title: Tag category variant definition
description: Schema for OpenPrintTag tag category variant definitions.

type: array
items:
type: object
description: Tag category variant.
additionalProperties: false

required: [ name, display_name ]

properties:
name:
type: string
pattern: "^[a-z0-9_+-]*$"
description: Tag category name.
display_name:
type: string
description: The human-readable name of the tag category.
emoji:
type: string
pattern: "^[\\p{So}\\p{Sk}\\p{Sm}\\p{Sc}]\\uFE0F?$"
description: Emoji pictogram for this tag category variant.
deprecated:
type: boolean
description: Whether the tag category is deprecated.
Loading