From 008d9b8bb6cf501d26b1e4b346fd728f75e8e959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Tue, 18 Apr 2023 18:34:12 +0200 Subject: [PATCH] feat: deprecate state api (#3551) ## About the changes This deprecates state API in favor of the new batch import/export --- src/lib/openapi/meta-schema-rules.test.ts | 1 - src/lib/openapi/spec/state-schema.ts | 3 +++ src/lib/routes/admin-api/state.ts | 8 ++++++++ .../api/openapi/__snapshots__/openapi.e2e.test.ts.snap | 8 ++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/openapi/meta-schema-rules.test.ts b/src/lib/openapi/meta-schema-rules.test.ts index 0c3a2df797..a1e9a06c98 100644 --- a/src/lib/openapi/meta-schema-rules.test.ts +++ b/src/lib/openapi/meta-schema-rules.test.ts @@ -278,7 +278,6 @@ const metaRules: Rule[] = [ 'setUiConfigSchema', 'sortOrderSchema', 'splashSchema', - 'stateSchema', 'strategiesSchema', 'tagTypeSchema', 'tagTypesSchema', diff --git a/src/lib/openapi/spec/state-schema.ts b/src/lib/openapi/spec/state-schema.ts index 9d4261ccb7..55d81df2ca 100644 --- a/src/lib/openapi/spec/state-schema.ts +++ b/src/lib/openapi/spec/state-schema.ts @@ -15,6 +15,9 @@ export const stateSchema = { $id: '#/components/schemas/stateSchema', type: 'object', additionalProperties: true, + deprecated: true, + description: + 'The state of the application used by export/import APIs which are deprecated in favor of the more fine grained /api/admin/export and /api/admin/import APIs', required: ['version'], properties: { version: { diff --git a/src/lib/routes/admin-api/state.ts b/src/lib/routes/admin-api/state.ts index 45499c02da..64561307bd 100644 --- a/src/lib/routes/admin-api/state.ts +++ b/src/lib/routes/admin-api/state.ts @@ -64,6 +64,10 @@ class StateController extends Controller { this.openApiService.validPath({ tags: ['Import/Export'], operationId: 'import', + deprecated: true, + summary: 'Import state (deprecated)', + description: + 'Imports state into the system. Deprecated in favor of /api/admin/features-batch/import', responses: { 202: emptyResponse, }, @@ -80,6 +84,10 @@ class StateController extends Controller { this.openApiService.validPath({ tags: ['Import/Export'], operationId: 'export', + deprecated: true, + summary: 'Export state (deprecated)', + description: + 'Exports the current state of the system. Deprecated in favor of /api/admin/features-batch/export', responses: { 200: createResponseSchema('stateSchema'), }, 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 4ff4a28e8e..0e9ca77865 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 @@ -4110,6 +4110,8 @@ Stats are divided into current and previous **windows**. }, "stateSchema": { "additionalProperties": true, + "deprecated": true, + "description": "The state of the application used by export/import APIs which are deprecated in favor of the more fine grained /api/admin/export and /api/admin/import APIs", "properties": { "environments": { "items": { @@ -8501,6 +8503,8 @@ If the provided project does not exist, the list of events will be empty.", }, "/api/admin/state/export": { "get": { + "deprecated": true, + "description": "Exports the current state of the system. Deprecated in favor of /api/admin/features-batch/export", "operationId": "export", "parameters": [ { @@ -8649,6 +8653,7 @@ If the provided project does not exist, the list of events will be empty.", "description": "stateSchema", }, }, + "summary": "Export state (deprecated)", "tags": [ "Import/Export", ], @@ -8656,6 +8661,8 @@ If the provided project does not exist, the list of events will be empty.", }, "/api/admin/state/import": { "post": { + "deprecated": true, + "description": "Imports state into the system. Deprecated in favor of /api/admin/features-batch/import", "operationId": "import", "requestBody": { "content": { @@ -8673,6 +8680,7 @@ If the provided project does not exist, the list of events will be empty.", "description": "This response has no body.", }, }, + "summary": "Import state (deprecated)", "tags": [ "Import/Export", ],