Json-schema: extend interface by header to allow schema spec and arbitrary extensions

This commit is contained in:
Johannes Kirschbauer
2024-07-14 10:44:42 +02:00
parent b01d12dd26
commit 3034b9ef92
6 changed files with 26 additions and 77 deletions

View File

@@ -1,2 +0,0 @@
module: "clan.lol/inventory"
language: version: "v0.8.2"

View File

@@ -1,23 +0,0 @@
package inventory
import (
"clan.lol/inventory/schema"
)
@jsonschema(schema="http://json-schema.org/schema#")
#Root: {
meta: {
// A name of the clan (primarily shown by the UI)
name: string
// A description of the clan
description?: string
// The icon path
icon?: string
}
// // A map of services
schema.#service
// // A map of machines
schema.#machine
}

View File

@@ -1,40 +0,0 @@
package schema
#machine: machines: [string]: {
name: string,
description?: string,
icon?: string
tags: [...string]
system?: string
}
#role: string
#service: services: [string]: [string]: {
// Required meta fields
meta: {
name: string,
icon?: string
description?: string,
},
// We moved the machine sepcific config to "machines".
// It may be moved back depending on what makes more sense in the future.
roles: [#role]: {
machines: [...string],
tags: [...string],
}
machines?: {
[string]: {
config?: {
...
}
}
},
// Global Configuration for the service
config?: {
// Schema depends on the module.
// It declares the interface how the service can be configured.
...
}
}