Skip to content

Commit 3c3f2af

Browse files
authored
feat(schema): define database entry for hardware (#405)
1 parent 0b04e65 commit 3c3f2af

File tree

5 files changed

+123
-17
lines changed

5 files changed

+123
-17
lines changed

docs/static/schemas/draft/2-1-0/application.schema.json

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,9 +696,12 @@
696696
"type": "object",
697697
"additionalProperties": false,
698698
"properties": {
699+
"database_entry": {
700+
"$ref": "#/$defs/database_entry"
701+
},
699702
"urdf": {
700703
"title": "URDF",
701-
"description": "The path to the URDF file of the hardware",
704+
"description": "The URDF describing the hardware",
702705
"type": "string"
703706
},
704707
"rate": {
@@ -884,8 +887,29 @@
884887
}
885888
},
886889
"required": [
887-
"urdf",
888890
"rate"
891+
],
892+
"oneOf": [
893+
{
894+
"required": [
895+
"database_entry"
896+
],
897+
"not": {
898+
"required": [
899+
"urdf"
900+
]
901+
}
902+
},
903+
{
904+
"required": [
905+
"urdf"
906+
],
907+
"not": {
908+
"required": [
909+
"database_entry"
910+
]
911+
}
912+
}
889913
]
890914
}
891915
}
@@ -1441,6 +1465,33 @@
14411465
}
14421466
}
14431467
},
1468+
"database_entry": {
1469+
"$schema": "https://json-schema.org/draft/2020-12/schema",
1470+
"title": "Database Entry",
1471+
"description": "The details of a database entry",
1472+
"type": "object",
1473+
"additionalProperties": false,
1474+
"properties": {
1475+
"id": {
1476+
"title": "Database ID",
1477+
"description": "The ID of the entry in the database",
1478+
"type": "string"
1479+
},
1480+
"version": {
1481+
"title": "Version Tag",
1482+
"description": "The name of a tagged version of the entry in the database. If omitted, the latest version will be used.",
1483+
"type": "string",
1484+
"examples": [
1485+
"v1",
1486+
"release-2025-01",
1487+
"stable"
1488+
]
1489+
}
1490+
},
1491+
"required": [
1492+
"id"
1493+
]
1494+
},
14441495
"identifier": {
14451496
"$schema": "https://json-schema.org/draft/2020-12/schema",
14461497
"$comment": "The unique identifier of an application element (e.g., a component, controller, condition, or similar) formatted in lower_snake_case",

schemas/applications/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Release Versions:
2222
## Upcoming changes (draft/2-1-0)
2323

2424
- feat: add support for variables and assignments (#386)
25+
- feat: define database entry for referencing hardware (#405)
2526

2627
## 2-0-6
2728

schemas/applications/schema/application.schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
"condition_object": {
135135
"$ref": "common/condition_object.schema.json"
136136
},
137+
"database_entry": {
138+
"$ref": "common/database_entry.schema.json"
139+
},
137140
"identifier": {
138141
"$ref": "common/identifier.schema.json"
139142
},
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Database Entry",
4+
"description": "The details of a database entry",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"properties": {
8+
"id": {
9+
"title": "Database ID",
10+
"description": "The ID of the entry in the database",
11+
"type": "string"
12+
},
13+
"version": {
14+
"title": "Version Tag",
15+
"description": "The name of a tagged version of the entry in the database. If omitted, the latest version will be used.",
16+
"type": "string",
17+
"examples": [
18+
"v1",
19+
"release-2025-01",
20+
"stable"
21+
]
22+
}
23+
},
24+
"required": [
25+
"id"
26+
]
27+
}

schemas/applications/schema/hardware.schema.json

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"type": "object",
1212
"additionalProperties": false,
1313
"properties": {
14+
"database_entry": {
15+
"$ref": "common/database_entry.schema.json"
16+
},
1417
"urdf": {
1518
"title": "URDF",
16-
"description": "The path to the URDF file of the hardware",
19+
"description": "The URDF describing the hardware",
1720
"type": "string"
1821
},
1922
"rate": {
@@ -27,21 +30,21 @@
2730
]
2831
},
2932
"tf_prefix": {
30-
"description": "An optional TF prefix to apply to all of the links in the URDF to distinguish multiple instances of the same robot",
31-
"type": "string",
32-
"default": "",
33-
"examples": [
34-
"my_robot_",
35-
"left_robot_",
36-
"robot_1_"
37-
]
33+
"description": "An optional TF prefix to apply to all of the links in the URDF to distinguish multiple instances of the same robot",
34+
"type": "string",
35+
"default": "",
36+
"examples": [
37+
"my_robot_",
38+
"left_robot_",
39+
"robot_1_"
40+
]
3841
},
3942
"reference_frame": {
40-
"description": "An optional reference frame to relocate the hardware in the 3D scene. If left empty, the root link in the URDF will be used as the reference frame of the hardware instead.",
41-
"type": "string",
42-
"examples": [
43-
"world"
44-
]
43+
"description": "An optional reference frame to relocate the hardware in the 3D scene. If left empty, the root link in the URDF will be used as the reference frame of the hardware instead.",
44+
"type": "string",
45+
"examples": [
46+
"world"
47+
]
4548
},
4649
"strict": {
4750
"title": "Strict Hardware",
@@ -199,8 +202,29 @@
199202
}
200203
},
201204
"required": [
202-
"urdf",
203205
"rate"
206+
],
207+
"oneOf": [
208+
{
209+
"required": [
210+
"database_entry"
211+
],
212+
"not": {
213+
"required": [
214+
"urdf"
215+
]
216+
}
217+
},
218+
{
219+
"required": [
220+
"urdf"
221+
],
222+
"not": {
223+
"required": [
224+
"database_entry"
225+
]
226+
}
227+
}
204228
]
205229
}
206230
}

0 commit comments

Comments
 (0)