From 0916402abf26d166080d50bfee1779a93f03f152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Tue, 28 Feb 2023 14:36:25 +0100 Subject: [PATCH] chore: Improve bulk metrics endpoint (#3213) ## About the changes This adds support for connectVia the way we intend to use it and start now supports also a string --- .../openapi/spec/bulk-registration-schema.ts | 18 +++++++++++++++--- .../__snapshots__/openapi.e2e.test.ts.snap | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/lib/openapi/spec/bulk-registration-schema.ts b/src/lib/openapi/spec/bulk-registration-schema.ts index 71197c8e62..ce8ee1948b 100644 --- a/src/lib/openapi/spec/bulk-registration-schema.ts +++ b/src/lib/openapi/spec/bulk-registration-schema.ts @@ -1,4 +1,5 @@ import { FromSchema } from 'json-schema-to-ts'; +import { dateSchema } from './date-schema'; export const bulkRegistrationSchema = { $id: '#/components/schemas/bulkRegistrationSchema', @@ -8,7 +9,16 @@ export const bulkRegistrationSchema = { connectVia: { type: 'array', items: { - type: 'string', + type: 'object', + required: ['appName', 'instanceId'], + properties: { + appName: { + type: 'string', + }, + instanceId: { + type: 'string', + }, + }, }, }, appName: { @@ -24,7 +34,7 @@ export const bulkRegistrationSchema = { type: 'number', }, started: { - type: 'number', + $ref: '#/components/schemas/dateSchema', }, strategies: { type: 'array', @@ -37,7 +47,9 @@ export const bulkRegistrationSchema = { }, }, components: { - schemas: {}, + schemas: { + dateSchema, + }, }, } as const; diff --git a/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap b/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap index 0fcae1d5e7..4e98a06e11 100644 --- a/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap +++ b/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap @@ -352,7 +352,19 @@ exports[`should serve the OpenAPI spec 1`] = ` }, "connectVia": { "items": { - "type": "string", + "properties": { + "appName": { + "type": "string", + }, + "instanceId": { + "type": "string", + }, + }, + "required": [ + "appName", + "instanceId", + ], + "type": "object", }, "type": "array", }, @@ -369,7 +381,7 @@ exports[`should serve the OpenAPI spec 1`] = ` "type": "string", }, "started": { - "type": "number", + "$ref": "#/components/schemas/dateSchema", }, "strategies": { "items": {