The open source OpenXR runtime

doc: Add JSON Schema

authored by

Ryan Pavlik and committed by
Christoph Haag
a11ce715 76ed4d16

+242
+8
doc/CMakeLists.txt
··· 29 # request to configure the file 30 configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 31 32 # note the option ALL which allows to build the docs together with the application 33 add_custom_target(doc_doxygen ALL 34 COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
··· 29 # request to configure the file 30 configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) 31 32 + # copy the schema 33 + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json 34 + ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json 35 + @ONLY) 36 + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/example_configs/config_v0.schema.json.license 37 + ${CMAKE_CURRENT_BINARY_DIR}/html/config_v0.schema.json.license 38 + @ONLY) 39 + 40 # note the option ALL which allows to build the docs together with the application 41 add_custom_target(doc_doxygen ALL 42 COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
+4
doc/changes/misc_features/mr.785.md
···
··· 1 + --- 2 + - issue.82 3 + --- 4 + Add JSON Schema for config files.
+228
doc/example_configs/config_v0.schema.json
···
··· 1 + { 2 + "$schema": "http://json-schema.org/draft-07/schema", 3 + "title": "Monado configuration file schema v0", 4 + "type": "object", 5 + "properties": { 6 + "$schema": { 7 + "type": "string", 8 + "title": "JSON Schema directive", 9 + "default": "https://monado.pages.freedesktop.org/monado/config_v0.schema.json" 10 + }, 11 + "active": { 12 + "type": "string", 13 + "title": "Name of the active config object", 14 + "description": "Must match a key in the top-level object. Only config data in that object will be used.", 15 + "$comment": "have omitted 'none' because it primarily exists for environment overrides: just leave out this key in the json for 'none'", 16 + "enum": [ 17 + "tracking", 18 + "remote" 19 + ] 20 + }, 21 + "tracking": { 22 + "$ref": "#/definitions/tracking" 23 + }, 24 + "remote": { 25 + "$ref": "#/definitions/remote" 26 + } 27 + }, 28 + "definitions": { 29 + "remote": { 30 + "title": "Remote device configuration", 31 + "required": [ 32 + "version" 33 + ], 34 + "properties": { 35 + "port": { 36 + "type": "integer" 37 + }, 38 + "version": { 39 + "type": "integer", 40 + "title": "Remote config file schema version", 41 + "enum": [ 42 + 0 43 + ] 44 + } 45 + } 46 + }, 47 + "tracking": { 48 + "title": "Tracking configuration", 49 + "required": [ 50 + "version" 51 + ], 52 + "properties": { 53 + "version": { 54 + "type": "integer", 55 + "title": "Tracking config file schema version", 56 + "enum": [ 57 + 0 58 + ] 59 + }, 60 + "tracking_overrides": { 61 + "$ref": "#/definitions/tracking_overrides" 62 + }, 63 + "camera_name": { 64 + "type": "string" 65 + }, 66 + "camera_mode": { 67 + "type": "integer" 68 + }, 69 + "camera_type": { 70 + "type": "string", 71 + "enum": [ 72 + "regular_mono", 73 + "regular_sbs", 74 + "ps4", 75 + "leap_motion" 76 + ] 77 + }, 78 + "calibration_path": { 79 + "type": "string" 80 + }, 81 + } 82 + }, 83 + "tracking_overrides": { 84 + "title": "Tracking overrides", 85 + "type": "array", 86 + "items": { 87 + "$ref": "#/definitions/tracking_override" 88 + } 89 + }, 90 + "tracking_override": { 91 + "type": "object", 92 + "title": "Tracking override object", 93 + "required": [ 94 + "target_device_serial", 95 + "tracker_device_serial", 96 + "type" 97 + ], 98 + "properties": { 99 + "target_device_serial": { 100 + "title": "Target Device Serial", 101 + "$ref": "#/definitions/device_serial" 102 + }, 103 + "tracker_device_serial": { 104 + "title": "Tracker Device Serial", 105 + "$ref": "#/definitions/device_serial" 106 + }, 107 + "type": { 108 + "type": "string", 109 + "enum": [ 110 + "direct", 111 + "attached" 112 + ] 113 + }, 114 + "offset": { 115 + "type": "object", 116 + "title": "Tracking offset", 117 + "default": { 118 + "orientation": { 119 + "x": 0, 120 + "y": 0, 121 + "z": 0, 122 + "w": 1 123 + }, 124 + "position": { 125 + "x": 0, 126 + "y": 0, 127 + "z": 0 128 + } 129 + }, 130 + "required": [ 131 + "orientation", 132 + "position" 133 + ], 134 + "properties": { 135 + "orientation": { 136 + "$ref": "#/definitions/quaternion" 137 + }, 138 + "position": { 139 + "title": "Position offset", 140 + "$ref": "#/definitions/vector3" 141 + } 142 + } 143 + }, 144 + "xrt_input_name": { 145 + "type": "string", 146 + "enum": [ 147 + "XRT_INPUT_HYDRA_POSE", 148 + "XRT_INPUT_TOUCH_AIM_POSE", 149 + "XRT_INPUT_SIMPLE_AIM_POSE", 150 + "XRT_INPUT_GENERIC_HEAD_DETECT", 151 + "XRT_INPUT_SIMPLE_GRIP_POSE", 152 + "XRT_INPUT_INDEX_GRIP_POSE", 153 + "XRT_INPUT_VIVE_GRIP_POSE", 154 + "XRT_INPUT_PSMV_AIM_POSE", 155 + "XRT_INPUT_WMR_AIM_POSE", 156 + "XRT_INPUT_WMR_GRIP_POSE", 157 + "XRT_INPUT_PSMV_BODY_CENTER_POSE", 158 + "XRT_INPUT_HAND_AIM_POSE", 159 + "XRT_INPUT_INDEX_AIM_POSE", 160 + "XRT_INPUT_DAYDREAM_POSE", 161 + "XRT_INPUT_GENERIC_HEAD_POSE", 162 + "XRT_INPUT_PSMV_BALL_CENTER_POSE", 163 + "XRT_INPUT_GO_GRIP_POSE", 164 + "XRT_INPUT_TOUCH_GRIP_POSE", 165 + "XRT_INPUT_HAND_GRIP_POSE", 166 + "XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT", 167 + "XRT_INPUT_GENERIC_HAND_TRACKING_LEFT", 168 + "XRT_INPUT_GENERIC_TRACKER_POSE", 169 + "XRT_INPUT_PSMV_GRIP_POSE", 170 + "XRT_INPUT_GO_AIM_POSE", 171 + "XRT_INPUT_VIVE_AIM_POSE" 172 + ], 173 + "default": "XRT_INPUT_GENERIC_TRACKER_POSE" 174 + } 175 + } 176 + }, 177 + "device_serial": { 178 + "type": "string", 179 + "title": "Device serial", 180 + "description": "The unique string assigned to a particular instance of a device by the driver." 181 + }, 182 + "quaternion": { 183 + "type": "object", 184 + "title": "Quaternion", 185 + "description": "Should be normalized (length == 1) to represent rotation", 186 + "properties": { 187 + "x": { 188 + "type": "number" 189 + }, 190 + "y": { 191 + "type": "number" 192 + }, 193 + "z": { 194 + "type": "number" 195 + }, 196 + "w": { 197 + "type": "number" 198 + } 199 + }, 200 + "required": [ 201 + "x", 202 + "y", 203 + "z", 204 + "w" 205 + ] 206 + }, 207 + "vec3": { 208 + "type": "object", 209 + "title": "Vector3", 210 + "properties": { 211 + "x": { 212 + "type": "number" 213 + }, 214 + "y": { 215 + "type": "number" 216 + }, 217 + "z": { 218 + "type": "number" 219 + } 220 + }, 221 + "required": [ 222 + "x", 223 + "y", 224 + "z" 225 + ] 226 + } 227 + } 228 + }
+2
doc/example_configs/config_v0.schema.json.license
···
··· 1 + Copyright 2021, Collabora, Ltd. 2 + SPDX-License-Identifier: CC0-1.0