diff --git a/src/lib/openapi/spec/create-strategy-schema.ts b/src/lib/openapi/spec/create-strategy-schema.ts index fecae9ae9e..177c194352 100644 --- a/src/lib/openapi/spec/create-strategy-schema.ts +++ b/src/lib/openapi/spec/create-strategy-schema.ts @@ -5,7 +5,6 @@ import { constraintSchema } from './constraint-schema'; export const createStrategySchema = { $id: '#/components/schemas/createStrategySchema', type: 'object', - additionalProperties: false, required: ['name'], properties: { name: { diff --git a/src/lib/openapi/spec/update-tag-type-schema.ts b/src/lib/openapi/spec/update-tag-type-schema.ts index a6606a3bd0..c814a2d7c8 100644 --- a/src/lib/openapi/spec/update-tag-type-schema.ts +++ b/src/lib/openapi/spec/update-tag-type-schema.ts @@ -3,7 +3,6 @@ import { FromSchema } from 'json-schema-to-ts'; export const updateTagTypeSchema = { $id: '#/components/schemas/updateTagTypeSchema', type: 'object', - additionalProperties: false, properties: { description: { type: 'string', diff --git a/src/lib/openapi/spec/validate-tag-type-schema.ts b/src/lib/openapi/spec/validate-tag-type-schema.ts index 9346941901..1d669eab82 100644 --- a/src/lib/openapi/spec/validate-tag-type-schema.ts +++ b/src/lib/openapi/spec/validate-tag-type-schema.ts @@ -4,7 +4,6 @@ import { tagTypeSchema } from './tag-type-schema'; export const validateTagTypeSchema = { $id: '#/components/schemas/validateTagTypeSchema', type: 'object', - additionalProperties: false, required: ['valid', 'tagType'], properties: { valid: { 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 5c1d2bfccc..77014afb79 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 @@ -46,11 +46,119 @@ exports[`should serve the OpenAPI UI 1`] = ` " `; - exports[`should serve the OpenAPI spec 1`] = ` Object { "components": Object { "schemas": Object { + "apiTokenSchema": Object { + "additionalProperties": false, + "properties": Object { + "createdAt": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "environment": Object { + "type": "string", + }, + "expiresAt": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "project": Object { + "type": "string", + }, + "projects": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "secret": Object { + "type": "string", + }, + "seenAt": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "type": Object { + "description": "client, admin.", + "type": "string", + }, + "username": Object { + "type": "string", + }, + }, + "required": Array [ + "username", + "type", + ], + "type": "object", + }, + "apiTokensSchema": Object { + "additionalProperties": false, + "properties": Object { + "tokens": Object { + "items": Object { + "$ref": "#/components/schemas/apiTokenSchema", + }, + "type": "array", + }, + }, + "required": Array [ + "tokens", + ], + "type": "object", + }, + "applicationSchema": Object { + "additionalProperties": false, + "properties": Object { + "announced": Object { + "type": "boolean", + }, + "appName": Object { + "type": "string", + }, + "color": Object { + "type": "string", + }, + "description": Object { + "type": "string", + }, + "icon": Object { + "type": "string", + }, + "sdkVersion": Object { + "type": "string", + }, + "strategies": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "url": Object { + "type": "string", + }, + }, + "required": Array [ + "appName", + ], + "type": "object", + }, + "applicationsSchema": Object { + "properties": Object { + "applications": Object { + "items": Object { + "$ref": "#/components/schemas/applicationSchema", + }, + "type": "array", + }, + }, + "type": "object", + }, "cloneFeatureSchema": Object { "properties": Object { "name": Object { @@ -113,6 +221,80 @@ Object { ], "type": "object", }, + "contextFieldSchema": Object { + "additionalProperties": false, + "properties": Object { + "createdAt": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "description": Object { + "type": "string", + }, + "legalValues": Object { + "items": Object { + "$ref": "#/components/schemas/legalValueSchema", + }, + "type": "array", + }, + "name": Object { + "type": "string", + }, + "sortOrder": Object { + "type": "number", + }, + "stickiness": Object { + "type": "boolean", + }, + }, + "required": Array [ + "name", + ], + "type": "object", + }, + "contextFieldsSchema": Object { + "items": Object { + "$ref": "#/components/schemas/contextFieldSchema", + }, + "type": "array", + }, + "createApiTokenSchema": Object { + "properties": Object { + "environment": Object { + "type": "string", + }, + "expiresAt": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "project": Object { + "type": "string", + }, + "projects": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "secret": Object { + "type": "string", + }, + "type": Object { + "description": "client, admin.", + "type": "string", + }, + "username": Object { + "type": "string", + }, + }, + "required": Array [ + "username", + "type", + ], + "type": "object", + }, "createFeatureSchema": Object { "properties": Object { "description": Object { @@ -134,7 +316,6 @@ Object { "type": "object", }, "createStrategySchema": Object { - "additionalProperties": false, "properties": Object { "constraints": Object { "items": Object { @@ -422,6 +603,43 @@ Object { ], "type": "object", }, + "feedbackSchema": Object { + "additionalProperties": false, + "properties": Object { + "feedbackId": Object { + "type": "string", + }, + "given": Object { + "format": "date-time", + "nullable": true, + "type": "string", + }, + "neverShow": Object { + "type": "boolean", + }, + "userId": Object { + "type": "number", + }, + }, + "required": Array [], + "type": "object", + }, + "healthCheckSchema": Object { + "additionalProperties": false, + "properties": Object { + "health": Object { + "enum": Array [ + "GOOD", + "BAD", + ], + "type": "string", + }, + }, + "required": Array [ + "health", + ], + "type": "object", + }, "healthOverviewSchema": Object { "additionalProperties": false, "properties": Object { @@ -518,6 +736,33 @@ Object { ], "type": "object", }, + "legalValueSchema": Object { + "additionalProperties": false, + "properties": Object { + "description": Object { + "type": "string", + }, + "value": Object { + "type": "string", + }, + }, + "required": Array [ + "value", + ], + "type": "object", + }, + "nameSchema": Object { + "additionalProperties": false, + "properties": Object { + "name": Object { + "type": "string", + }, + }, + "required": Array [ + "name", + ], + "type": "object", + }, "overrideSchema": Object { "additionalProperties": false, "properties": Object { @@ -749,6 +994,22 @@ Object { ], "type": "object", }, + "tagWithVersionSchema": Object { + "additionalProperties": false, + "properties": Object { + "tag": Object { + "$ref": "#/components/schemas/tagSchema", + }, + "version": Object { + "type": "integer", + }, + }, + "required": Array [ + "version", + "tag", + ], + "type": "object", + }, "tagsSchema": Object { "additionalProperties": false, "properties": Object { @@ -788,6 +1049,9 @@ Object { "disablePasswordAuth": Object { "type": "boolean", }, + "environment": Object { + "type": "string", + }, "flags": Object { "additionalProperties": Object { "type": "boolean", @@ -833,6 +1097,18 @@ Object { ], "type": "object", }, + "updateApiTokenSchema": Object { + "properties": Object { + "expiresAt": Object { + "format": "date-time", + "type": "string", + }, + }, + "required": Array [ + "expiresAt", + ], + "type": "object", + }, "updateFeatureSchema": Object { "properties": Object { "archived": Object { @@ -895,7 +1171,6 @@ Object { "type": "object", }, "updateTagTypeSchema": Object { - "additionalProperties": false, "properties": Object { "description": Object { "type": "string", @@ -906,8 +1181,33 @@ Object { }, "type": "object", }, + "upsertContextFieldSchema": Object { + "properties": Object { + "description": Object { + "type": "string", + }, + "legalValues": Object { + "items": Object { + "$ref": "#/components/schemas/legalValueSchema", + }, + "type": "array", + }, + "name": Object { + "type": "string", + }, + "sortOrder": Object { + "type": "number", + }, + "stickiness": Object { + "type": "boolean", + }, + }, + "required": Array [ + "name", + ], + "type": "object", + }, "validateTagTypeSchema": Object { - "additionalProperties": false, "properties": Object { "tagType": Object { "$ref": "#/components/schemas/tagTypeSchema", @@ -1029,6 +1329,110 @@ Object { }, "openapi": "3.0.3", "paths": Object { + "/api/admin/api-tokens": Object { + "get": Object { + "operationId": "getAllApiTokens", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/apiTokensSchema", + }, + }, + }, + "description": "apiTokensSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + "post": Object { + "operationId": "createApiToken", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/createApiTokenSchema", + }, + }, + }, + "description": "createApiTokenSchema", + "required": true, + }, + "responses": Object { + "201": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/apiTokenSchema", + }, + }, + }, + "description": "apiTokenSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/api-tokens/{token}": Object { + "delete": Object { + "operationId": "deleteApiToken", + "parameters": Array [ + Object { + "in": "path", + "name": "token", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + "put": Object { + "operationId": "updateApiToken", + "parameters": Array [ + Object { + "in": "path", + "name": "token", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/updateApiTokenSchema", + }, + }, + }, + "description": "updateApiTokenSchema", + "required": true, + }, + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, "/api/admin/archive/features": Object { "get": Object { "deprecated": true, @@ -1154,6 +1558,155 @@ Object { ], }, }, + "/api/admin/context": Object { + "get": Object { + "operationId": "getContextFields", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/contextFieldsSchema", + }, + }, + }, + "description": "contextFieldsSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + "post": Object { + "operationId": "createContextField", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/upsertContextFieldSchema", + }, + }, + }, + "description": "upsertContextFieldSchema", + "required": true, + }, + "responses": Object { + "201": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/context/validate": Object { + "post": Object { + "operationId": "validate", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/nameSchema", + }, + }, + }, + "description": "nameSchema", + "required": true, + }, + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/context/{contextField}": Object { + "delete": Object { + "operationId": "deleteContextField", + "parameters": Array [ + Object { + "in": "path", + "name": "contextField", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + "get": Object { + "operationId": "getContextField", + "parameters": Array [ + Object { + "in": "path", + "name": "contextField", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/contextFieldSchema", + }, + }, + }, + "description": "contextFieldSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + "put": Object { + "operationId": "updateContextField", + "parameters": Array [ + Object { + "in": "path", + "name": "contextField", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/upsertContextFieldSchema", + }, + }, + }, + "description": "upsertContextFieldSchema", + "required": true, + }, + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, "/api/admin/environments": Object { "get": Object { "operationId": "getAllEnvironments", @@ -1235,7 +1788,7 @@ Object { }, ], "responses": Object { - "200": Object { + "204": Object { "description": "emptyResponse", }, }, @@ -1258,7 +1811,7 @@ Object { }, ], "responses": Object { - "200": Object { + "204": Object { "description": "emptyResponse", }, }, @@ -1429,6 +1982,181 @@ Object { ], }, }, + "/api/admin/feedback": Object { + "post": Object { + "operationId": "createFeedback", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/feedbackSchema", + }, + }, + }, + "description": "feedbackSchema", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/feedbackSchema", + }, + }, + }, + "description": "feedbackSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/feedback/{id}": Object { + "put": Object { + "operationId": "updateFeedback", + "parameters": Array [ + Object { + "in": "path", + "name": "id", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/feedbackSchema", + }, + }, + }, + "description": "feedbackSchema", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/feedbackSchema", + }, + }, + }, + "description": "feedbackSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/metrics/applications": Object { + "get": Object { + "operationId": "getApplications", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/applicationsSchema", + }, + }, + }, + "description": "applicationsSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/metrics/applications/{appName}": Object { + "delete": Object { + "operationId": "deleteApplication", + "parameters": Array [ + Object { + "in": "path", + "name": "appName", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + "get": Object { + "operationId": "getApplication", + "parameters": Array [ + Object { + "in": "path", + "name": "appName", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/applicationSchema", + }, + }, + }, + "description": "applicationSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + "post": Object { + "operationId": "createApplication", + "parameters": Array [ + Object { + "in": "path", + "name": "appName", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/applicationSchema", + }, + }, + }, + "description": "applicationSchema", + "required": true, + }, + "responses": Object { + "202": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, "/api/admin/projects": Object { "get": Object { "operationId": "getProjects", @@ -2642,6 +3370,145 @@ Object { ], }, }, + "/api/admin/tags": Object { + "get": Object { + "operationId": "getTags", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/tagsSchema", + }, + }, + }, + "description": "tagsSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + "post": Object { + "operationId": "createTag", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/tagSchema", + }, + }, + }, + "description": "tagSchema", + "required": true, + }, + "responses": Object { + "201": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/tags/{type}": Object { + "get": Object { + "operationId": "getTagsByType", + "parameters": Array [ + Object { + "in": "path", + "name": "type", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/tagsSchema", + }, + }, + }, + "description": "tagsSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, + "/api/admin/tags/{type}/{value}": Object { + "delete": Object { + "operationId": "deleteTag", + "parameters": Array [ + Object { + "in": "path", + "name": "type", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "in": "path", + "name": "value", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "description": "emptyResponse", + }, + }, + "tags": Array [ + "admin", + ], + }, + "get": Object { + "operationId": "getTag", + "parameters": Array [ + Object { + "in": "path", + "name": "type", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "in": "path", + "name": "value", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/tagWithVersionSchema", + }, + }, + }, + "description": "tagWithVersionSchema", + }, + }, + "tags": Array [ + "admin", + ], + }, + }, "/api/admin/ui-config": Object { "get": Object { "operationId": "getUIConfig", @@ -2662,6 +3529,36 @@ Object { ], }, }, + "/health": Object { + "get": Object { + "operationId": "getHealth", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/healthCheckSchema", + }, + }, + }, + "description": "healthCheckSchema", + }, + "500": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/healthCheckSchema", + }, + }, + }, + "description": "healthCheckSchema", + }, + }, + "tags": Array [ + "other", + ], + }, + }, }, "security": Array [ Object {