diff --git a/schema/components.json b/schema/components.json index 9bfc81620..806ee6675 100644 --- a/schema/components.json +++ b/schema/components.json @@ -1,214 +1,228 @@ { - - "type": "object", - "additionalProperties": false, - "definitions": { - - "console-port": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/console-port/properties/type" - }, - "poe": { - "type": "boolean" - } - }, - "required": ["name", "type"] + "type": "object", + "additionalProperties": false, + "definitions": { + "console-port": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - - "console-server-port": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/console-server-port/properties/type" - } - }, - "required": ["name", "type"] + "label": { + "type": "string" }, - - "power-port": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/power-port/properties/type" - }, - "maximum_draw": { - "type": "integer" - }, - "allocated_draw": { - "type": "integer" - } - }, - "required": ["name", "type"] + "type": { + "$ref": "generated.json#/definitions/console-port/properties/type" }, - - "power-outlet": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/power-outlet/properties/type" - }, - "power_port": { - "type": "string" - }, - "feed_leg": { - "type": "string", - "enum": ["A", "B", "C"] - } - }, - "required": ["name", "type"] - }, - - "interface": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/interface/properties/type" - }, - "poe_mode": { - "$ref": "generated.json#/definitions/interface/properties/poe_mode" - }, - "poe_type": { - "$ref": "generated.json#/definitions/interface/properties/poe_type" - }, - "mgmt_only": { - "type": "boolean" - } - }, - "required": ["name", "type"] - }, - - "front-port": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/front-port/properties/type" - }, - "color": { - "type": "string", - "pattern": "^[a-f0-9]{6}$" - }, - "rear_port": { - "type": "string" - }, - "rear_port_position": { - "type": "integer" - } - }, - "required": ["name", "type", "rear_port"] - }, - - "rear-port": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "type": { - "$ref": "generated.json#/definitions/rear-port/properties/type" - }, - "color": { - "type": "string", - "pattern": "^[a-f0-9]{6}$" - }, - "positions": { - "type": "integer" - }, - "poe": { - "type": "boolean" - } - }, - "required": ["name", "type"] - }, - - "module-bay": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "position": { - "type": "string" - } - }, - "required": ["name"] - }, - - "device-bay": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": ["name"] - }, - - "inventory-item": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "label": { - "type": "string" - }, - "manufacturer": { - "type": "string" - }, - "part_id": { - "type": "string" - } - }, - "required": ["name"] + "poe": { + "type": "boolean" } - + }, + "required": [ + "name", + "type" + ] + }, + "console-server-port": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/console-server-port/properties/type" + } + }, + "required": [ + "name", + "type" + ] + }, + "power-port": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/power-port/properties/type" + }, + "maximum_draw": { + "type": "integer" + }, + "allocated_draw": { + "type": "integer" + } + }, + "required": [ + "name", + "type" + ] + }, + "power-outlet": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/power-outlet/properties/type" + }, + "power_port": { + "type": "string" + }, + "feed_leg": { + "$ref": "generated.json#/definitions/power-outlet/properties/feed-leg" + } + }, + "required": [ + "name", + "type" + ] + }, + "interface": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/interface/properties/type" + }, + "poe_mode": { + "$ref": "generated.json#/definitions/interface/properties/poe_mode" + }, + "poe_type": { + "$ref": "generated.json#/definitions/interface/properties/poe_type" + }, + "mgmt_only": { + "type": "boolean" + } + }, + "required": [ + "name", + "type" + ] + }, + "front-port": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/front-port/properties/type" + }, + "color": { + "type": "string", + "pattern": "^[a-f0-9]{6}$" + }, + "rear_port": { + "type": "string" + }, + "rear_port_position": { + "type": "integer" + } + }, + "required": [ + "name", + "type", + "rear_port" + ] + }, + "rear-port": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "$ref": "generated.json#/definitions/rear-port/properties/type" + }, + "color": { + "type": "string", + "pattern": "^[a-f0-9]{6}$" + }, + "positions": { + "type": "integer" + }, + "poe": { + "type": "boolean" + } + }, + "required": [ + "name", + "type" + ] + }, + "module-bay": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "position": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "device-bay": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "name" + ] + }, + "inventory-item": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string" + }, + "manufacturer": { + "type": "string" + }, + "part_id": { + "type": "string" + } + }, + "required": [ + "name" + ] } - -} + } +} \ No newline at end of file diff --git a/schema/devicetype.json b/schema/devicetype.json index cf0876489..eb03e6571 100644 --- a/schema/devicetype.json +++ b/schema/devicetype.json @@ -23,21 +23,13 @@ "type": "boolean" }, "airflow": { - "type": "string", - "enum": [ - "front-to-rear", - "rear-to-front", - "left-to-right", - "right-to-left", - "side-to-rear", - "passive" - ] + "$ref": "generated.json#/definitions/airflow" }, "weight": { - "$ref": "static.json#/definitions/weight" + "$ref": "reusable.json#/definitions/weight" }, "weight_unit": { - "$ref": "static.json#/definitions/weight_unit" + "$ref": "generated.json#/definitions/weight-unit" }, "front_image": { "type": "boolean" @@ -46,11 +38,7 @@ "type": "boolean" }, "subdevice_role": { - "type": "string", - "enum": [ - "parent", - "child" - ] + "$ref": "generated.json#/definitions/subdevice-role" }, "is_powered": { "type": "boolean" diff --git a/schema/generated.json b/schema/generated.json index 3978396f3..deba5347e 100644 --- a/schema/generated.json +++ b/schema/generated.json @@ -2,6 +2,33 @@ "type": "object", "additionalProperties": false, "definitions": { + "airflow": { + "type": "string", + "enum": [ + "front-to-rear", + "rear-to-front", + "left-to-right", + "right-to-left", + "side-to-rear", + "passive" + ] + }, + "weight-unit": { + "type": "string", + "enum": [ + "kg", + "g", + "lb", + "oz" + ] + }, + "subdevice-role": { + "type": "string", + "enum": [ + "parent", + "child" + ] + }, "console-port": { "type": "object", "properties": { @@ -30,28 +57,27 @@ "console-server-port": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "de-9", - "db-25", - "rj-12", - "rj-45", - "mini-din-8", - "usb-a", - "usb-b", - "usb-c", - "usb-mini-a", - "usb-mini-b", - "usb-micro-a", - "usb-micro-b", - "usb-micro-ab", - "other" - ] - } - }, - "required": ["name", "type"] - }, + "type": { + "type": "string", + "enum": [ + "de-9", + "db-25", + "rj-12", + "rj-45", + "mini-din-8", + "usb-a", + "usb-b", + "usb-c", + "usb-mini-a", + "usb-mini-b", + "usb-micro-a", + "usb-micro-b", + "usb-micro-ab", + "other" + ] + } + } + }, "power-port": { "type": "object", "properties": { @@ -249,7 +275,7 @@ "other" ] }, - "feed_leg": { + "feed-leg": { "type": "string", "enum": [ "A", diff --git a/schema/moduletype.json b/schema/moduletype.json index 498c41312..3d3436342 100644 --- a/schema/moduletype.json +++ b/schema/moduletype.json @@ -11,10 +11,10 @@ "type": "string" }, "weight": { - "$ref": "static.json#/definitions/weight" + "$ref": "reusable.json#/definitions/weight" }, "weight_unit": { - "$ref": "static.json#/definitions/weight_unit" + "$ref": "generated.json#/definitions/weight-unit" }, "console-ports": { "type": "array", diff --git a/schema/static.json b/schema/reusable.json similarity index 56% rename from schema/static.json rename to schema/reusable.json index c45c767dc..965ff1df5 100644 --- a/schema/static.json +++ b/schema/reusable.json @@ -6,15 +6,6 @@ "type": "number", "minimum": 0, "multipleOf": 0.01 - }, - "weight_unit": { - "type": "string", - "enum": [ - "kg", - "g", - "lb", - "oz" - ] } } } \ No newline at end of file