@@ -6,9 +6,9 @@ import * as path from "path";
66const __dirname = path . resolve ( ) ;
77
88process . on ( "uncaughtException" , function ( err ) {
9- // eslint-disable-next-line no-console
10- console . log ( err ) ;
11- process . exit ( 1 ) ;
9+ // eslint-disable-next-line no-console
10+ console . log ( err ) ;
11+ process . exit ( 1 ) ;
1212} ) ;
1313
1414const options = {
@@ -80,161 +80,31 @@ const options = {
8080 { BasicAuth : [ ] }
8181 ] ,
8282 } ,
83- servers : [ { url : "../" } ] ,
84- tags : [
85- //Swagger UI respects the order of these
86- { name : "Valetudo" , description : "Valetudo management API" } ,
87- { name : "ValetudoEvents" , description : "Valetudo Events" } ,
88- { name : "Robot" , description : "Robot API" } ,
89- { name : "System" , description : "System API" } ,
90- { name : "NTP" , description : "NTP Client API" } ,
91- { name : "Timers" , description : "Timers API" } ,
92- { name : "Updater" , description : "Update Valetudo using Valetudo" } ,
93-
94- {
95- name : "BasicControlCapability" ,
96- description : "Basic control capability" ,
97- } ,
98- {
99- name : "FanSpeedControlCapability" ,
100- description : "Fan speed control capability" ,
101- } ,
102- {
103- name : "WaterUsageControlCapability" ,
104- description : "Water usage control capability" ,
105- } ,
106- {
107- name : "WifiConfigurationCapability" ,
108- description : "Wi-Fi configuration capability" ,
109- } ,
110- { name : "WifiScanCapability" , description : "Wi-Fi scan capability" } ,
111- {
112- name : "ZoneCleaningCapability" ,
113- description : "Zone cleaning capability" ,
114- } ,
115- {
116- name : "MapSegmentationCapability" ,
117- description : "Map segment cleaning capability" ,
118- } ,
119- {
120- name : "ManualControlCapability" ,
121- description : "Manual control capability" ,
122- } ,
123- {
124- name : "DoNotDisturbCapability" ,
125- description : "Do-not-disturb configuration capability" ,
126- } ,
127- {
128- name : "ConsumableMonitoringCapability" ,
129- description : "Consumable monitoring capability" ,
130- } ,
131- { name : "LocateCapability" , description : "Robot locate capability" } ,
132- {
133- name : "GoToLocationCapability" ,
134- description : "Go-to location capability" ,
135- } ,
136- {
137- name : "CarpetModeControlCapability" ,
138- description : "Carpet mode settings capability" ,
139- } ,
140- { name : "MapResetCapability" , description : "Map reset capability" } ,
141- {
142- name : "MapSegmentEditCapability" ,
143- description : "Map segment edit capability" ,
144- } ,
145- {
146- name : "MapSegmentRenameCapability" ,
147- description : "Map segment rename capability" ,
148- } ,
149- {
150- name : "MapSnapshotCapability" ,
151- description : "Map snapshots capability" ,
152- } ,
153- {
154- name : "PersistentMapControlCapability" ,
155- description : "Persistent map control capability" ,
156- } ,
157- {
158- name : "SensorCalibrationCapability" ,
159- description : "Sensor calibration capability" ,
160- } ,
161- { name : "SpeakerTestCapability" , description : "Speaker test capability" } ,
162- {
163- name : "SpeakerVolumeControlCapability" ,
164- description : "Speaker volume control capability" ,
165- } ,
166- {
167- name : "VoicePackManagementCapability" ,
168- description : "Voice pack management capability" ,
169- } ,
170- {
171- name : "CombinedVirtualRestrictionsCapability" ,
172- description : "Combined virtual restrictions capability" ,
173- } ,
174- {
175- name : "PendingMapChangeHandlingCapability" ,
176- description : "Pending map change handling capability" ,
177- } ,
178- { name : "MappingPassCapability" , description : "Mapping pass capability" } ,
179- { name : "KeyLockCapability" , description : "Key lock capability" } ,
180- ] ,
181- components : {
182- responses : {
183- 200 : { description : "Ok" } ,
184- 201 : { description : "Created" } ,
185- 202 : { description : "Accepted" } ,
186- 400 : { description : "Bad request" } ,
187- 403 : { description : "Forbidden" } ,
188- 404 : { description : "Not found" } ,
189- 500 : { description : "Internal server error" } ,
190- } ,
191- parameters : { } ,
192- securitySchemes : {
193- BasicAuth : {
194- type : "http" ,
195- scheme : "basic" ,
196- } ,
197- } ,
198- } ,
199- security : [ { BasicAuth : [ ] } ] ,
200- } ,
201- apis : [
202- path . join ( __dirname , "./backend/util/openapi_defs/*.openapi.json" ) ,
203- path . join ( __dirname , "./backend/lib/doc/*.openapi.json" ) ,
204- path . join ( __dirname , "./backend/lib/webserver/doc/*.openapi.json" ) ,
205- path . join (
206- __dirname ,
207- "./backend/lib/webserver/capabilityRouters/doc/*.openapi.json"
208- ) ,
209- path . join (
210- __dirname ,
211- "./backend/lib/webserver/middlewares/doc/*.openapi.json"
212- ) ,
213- path . join ( __dirname , "./backend/lib/entities/doc/*.openapi.json" ) ,
214- path . join ( __dirname , "./backend/lib/entities/map/doc/*.openapi.json" ) ,
215- path . join ( __dirname , "./backend/lib/entities/core/doc/*.openapi.json" ) ,
216- path . join (
217- __dirname ,
218- "./backend/lib/entities/core/ntpClient/doc/*.openapi.json"
219- ) ,
220- path . join (
221- __dirname ,
222- "./backend/lib/entities/core/updater/doc/*.openapi.json"
223- ) ,
224- path . join ( __dirname , "./backend/lib/entities/state/doc/*.openapi.json" ) ,
225- path . join (
226- __dirname ,
227- "./backend/lib/entities/state/attributes/doc/*.openapi.json"
228- ) ,
229- path . join ( __dirname , "./backend/lib/core/capabilities/doc/*.openapi.json" ) ,
230- ] ,
83+ apis : [
84+ path . join ( __dirname , "./backend/util/openapi_defs/*.openapi.json" ) ,
85+ path . join ( __dirname , "./backend/lib/doc/*.openapi.json" ) ,
86+ path . join ( __dirname , "./backend/lib/webserver/doc/*.openapi.json" ) ,
87+ path . join ( __dirname , "./backend/lib/webserver/capabilityRouters/doc/*.openapi.json" ) ,
88+ path . join ( __dirname , "./backend/lib/webserver/middlewares/doc/*.openapi.json" ) ,
89+ path . join ( __dirname , "./backend/lib/entities/doc/*.openapi.json" ) ,
90+ path . join ( __dirname , "./backend/lib/entities/map/doc/*.openapi.json" ) ,
91+ path . join ( __dirname , "./backend/lib/entities/core/doc/*.openapi.json" ) ,
92+ path . join ( __dirname , "./backend/lib/entities/core/ntpClient/doc/*.openapi.json" ) ,
93+ path . join ( __dirname , "./backend/lib/entities/core/updater/doc/*.openapi.json" ) ,
94+ path . join ( __dirname , "./backend/lib/entities/state/doc/*.openapi.json" ) ,
95+ path . join ( __dirname , "./backend/lib/entities/state/attributes/doc/*.openapi.json" ) ,
96+ path . join ( __dirname , "./backend/lib/core/capabilities/doc/*.openapi.json" )
97+ ]
23198} ;
23299
233100const spec = await swaggerJsdoc ( options ) ;
234101
235102await SwaggerParser . validate ( spec ) ;
236103
104+
237105fs . writeFileSync (
238- path . join ( __dirname , "./backend/lib/res/valetudo.openapi.schema.json" ) ,
239- JSON . stringify ( spec )
106+ path . join ( __dirname , "./backend/lib/res/valetudo.openapi.schema.json" ) ,
107+ JSON . stringify ( spec )
240108) ;
109+
110+
0 commit comments