@xen-orchestra/rest-api 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backup-repositories/backup-repositories.controller.mjs +84 -2
- package/dist/hosts/host.controller.mjs +332 -2
- package/dist/hosts/host.service.mjs +76 -0
- package/dist/open-api/oa-examples/backup-repository.oa-example.mjs +6 -0
- package/dist/open-api/routes/routes.js +307 -4
- package/dist/open-api/schema/build-openapi-schema.mjs +8 -1
- package/dist/router/external-router.mjs +4 -1
- package/open-api/spec/swagger.json +1751 -795
- package/package.json +4 -4
|
@@ -11,10 +11,17 @@ export function buildOpenApiSchema(def) {
|
|
|
11
11
|
property.type = 'string';
|
|
12
12
|
property.enum = field.enum;
|
|
13
13
|
}
|
|
14
|
+
else if (field.type === 'object') {
|
|
15
|
+
property.type = 'object';
|
|
16
|
+
const nested = buildOpenApiSchema(field.fields);
|
|
17
|
+
property.properties = nested.properties;
|
|
18
|
+
if (nested.required?.length)
|
|
19
|
+
property.required = nested.required;
|
|
20
|
+
}
|
|
14
21
|
else {
|
|
15
22
|
property.type = field.type;
|
|
16
23
|
}
|
|
17
|
-
if (field.example !== undefined) {
|
|
24
|
+
if ('example' in field && field.example !== undefined) {
|
|
18
25
|
property.example = field.example;
|
|
19
26
|
}
|
|
20
27
|
schema.properties[key] = property;
|
|
@@ -203,10 +203,13 @@ function buildZodSchema(def) {
|
|
|
203
203
|
case 'enum':
|
|
204
204
|
schema = z.enum(field.enum);
|
|
205
205
|
break;
|
|
206
|
+
case 'object':
|
|
207
|
+
schema = buildZodSchema(field.fields);
|
|
208
|
+
break;
|
|
206
209
|
default:
|
|
207
210
|
throw new Error(`Unsupported type: ${field.type}`);
|
|
208
211
|
}
|
|
209
|
-
if (field.example)
|
|
212
|
+
if ('example' in field && field.example !== undefined)
|
|
210
213
|
schema = schema.meta({ example: field.example });
|
|
211
214
|
if (field.optional)
|
|
212
215
|
schema = schema.optional();
|