Added component definitions to add weight as a valid definition (#1061)

Added the required validation information
Updated the readme
This commit is contained in:
Daniel W. Anner
2023-01-19 11:40:40 -05:00
committed by GitHub
parent cdc3581843
commit 9f546df7fe
4 changed files with 50 additions and 0 deletions

View File

@ -63,6 +63,21 @@ The following fields may **optionally** be declared:
- `comments`: A string field which allows for comments to be added to the device. (**Default: None**)
- Type: String
> :test_tube: **Example**: `comments: This is a comment that will appear on all NetBox devices of this type`
- `weight`: An array with a **single** item that allow for a value and unit of measurement to be defined. (**Default: None**)
- Type: Array
- Value: Number - must be multiple of 0.01
- Unit: String
- Options:
- kg
- g
- lb
- oz
>:test_tube: **Example**:
>```
>weight:
> - value: 12.21
> unit: lb
>```
For further detail on these attributes and those listed below, please reference the
[schema definitions](schema/) and the [Component Definitions](#component-definitions) below.

View File

@ -594,6 +594,27 @@
}
},
"required": ["name"]
},
"weight": {
"type": "object",
"properties": {
"value": {
"type": "number",
"minimum": 0,
"multipleOf": 0.01
},
"unit": {
"type": "string",
"enum": [
"kg",
"g",
"lb",
"oz"
]
}
},
"required": ["value", "unit"]
}
}

View File

@ -33,6 +33,13 @@
"passive"
]
},
"weight": {
"type": "array",
"items": {
"$ref": "components.json#/definitions/weight"
},
"maxItems": 1
},
"subdevice_role": {
"type": "string",
"enum": [

View File

@ -54,6 +54,13 @@
},
"comments": {
"type": "string"
},
"weight": {
"type": "array",
"items": {
"$ref": "components.json#/definitions/weight"
},
"maxItems": 1
}
},
"required": ["manufacturer", "model"],