mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
Refactor: move openapi utils into /util directory (#1777)
* Refactor: move openapi utils into /util directory * Refactor: move utils test into `util` directory * Refactor: don't expose standard responses tied to status codes * Feat: update empty response description + make it const * Chore: update snapshot with new response descriptions
This commit is contained in:
parent
16dc677340
commit
1a5749ca08
@ -1,10 +1,4 @@
|
||||
import {
|
||||
createOpenApiSchema,
|
||||
createRequestSchema,
|
||||
createResponseSchema,
|
||||
removeJsonSchemaProps,
|
||||
schemas,
|
||||
} from './index';
|
||||
import { createOpenApiSchema, removeJsonSchemaProps, schemas } from './index';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@ -32,37 +26,6 @@ test('all schema $id attributes should have the expected format', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('createRequestSchema', () => {
|
||||
expect(createRequestSchema('schemaName')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"content": Object {
|
||||
"application/json": Object {
|
||||
"schema": Object {
|
||||
"$ref": "#/components/schemas/schemaName",
|
||||
},
|
||||
},
|
||||
},
|
||||
"description": "schemaName",
|
||||
"required": true,
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
test('createResponseSchema', () => {
|
||||
expect(createResponseSchema('schemaName')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"content": Object {
|
||||
"application/json": Object {
|
||||
"schema": Object {
|
||||
"$ref": "#/components/schemas/schemaName",
|
||||
},
|
||||
},
|
||||
},
|
||||
"description": "schemaName",
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
test('removeJsonSchemaProps', () => {
|
||||
expect(removeJsonSchemaProps({ a: 'b', $id: 'c', components: {} }))
|
||||
.toMatchInlineSnapshot(`
|
||||
|
@ -204,43 +204,6 @@ export interface JsonSchemaProps {
|
||||
components: object;
|
||||
}
|
||||
|
||||
export interface ApiOperation<Tag = 'admin' | 'client' | 'auth' | 'other'>
|
||||
extends Omit<OpenAPIV3.OperationObject, 'tags'> {
|
||||
operationId: string;
|
||||
tags: [Tag];
|
||||
}
|
||||
|
||||
export const createRequestSchema = (
|
||||
schemaName: string,
|
||||
): OpenAPIV3.RequestBodyObject => {
|
||||
return {
|
||||
description: schemaName,
|
||||
required: true,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: `#/components/schemas/${schemaName}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const createResponseSchema = (
|
||||
schemaName: string,
|
||||
): OpenAPIV3.ResponseObject => {
|
||||
return {
|
||||
description: schemaName,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: `#/components/schemas/${schemaName}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
// Remove JSONSchema keys that would result in an invalid OpenAPI spec.
|
||||
export const removeJsonSchemaProps = <T extends JsonSchemaProps>(
|
||||
schema: T,
|
||||
|
7
src/lib/openapi/util/api-operation.ts
Normal file
7
src/lib/openapi/util/api-operation.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
|
||||
export interface ApiOperation<Tag = 'admin' | 'client' | 'auth' | 'other'>
|
||||
extends Omit<OpenAPIV3.OperationObject, 'tags'> {
|
||||
operationId: string;
|
||||
tags: [Tag];
|
||||
}
|
17
src/lib/openapi/util/create-request-schema.test.ts
Normal file
17
src/lib/openapi/util/create-request-schema.test.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { createRequestSchema } from './create-request-schema';
|
||||
|
||||
test('createRequestSchema', () => {
|
||||
expect(createRequestSchema('schemaName')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"content": Object {
|
||||
"application/json": Object {
|
||||
"schema": Object {
|
||||
"$ref": "#/components/schemas/schemaName",
|
||||
},
|
||||
},
|
||||
},
|
||||
"description": "schemaName",
|
||||
"required": true,
|
||||
}
|
||||
`);
|
||||
});
|
17
src/lib/openapi/util/create-request-schema.ts
Normal file
17
src/lib/openapi/util/create-request-schema.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
|
||||
export const createRequestSchema = (
|
||||
schemaName: string,
|
||||
): OpenAPIV3.RequestBodyObject => {
|
||||
return {
|
||||
description: schemaName,
|
||||
required: true,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: `#/components/schemas/${schemaName}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
16
src/lib/openapi/util/create-response-schema.test.ts
Normal file
16
src/lib/openapi/util/create-response-schema.test.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { createResponseSchema } from './create-response-schema';
|
||||
|
||||
test('createResponseSchema', () => {
|
||||
expect(createResponseSchema('schemaName')).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"content": Object {
|
||||
"application/json": Object {
|
||||
"schema": Object {
|
||||
"$ref": "#/components/schemas/schemaName",
|
||||
},
|
||||
},
|
||||
},
|
||||
"description": "schemaName",
|
||||
}
|
||||
`);
|
||||
});
|
16
src/lib/openapi/util/create-response-schema.ts
Normal file
16
src/lib/openapi/util/create-response-schema.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
|
||||
export const createResponseSchema = (
|
||||
schemaName: string,
|
||||
): OpenAPIV3.ResponseObject => {
|
||||
return {
|
||||
description: schemaName,
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: {
|
||||
$ref: `#/components/schemas/${schemaName}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
@ -1,14 +1,14 @@
|
||||
export const emptyResponse = {
|
||||
description: 'emptyResponse',
|
||||
};
|
||||
description: 'This response has no body.',
|
||||
} as const;
|
||||
|
||||
export const unauthorizedResponse = {
|
||||
const unauthorizedResponse = {
|
||||
description:
|
||||
'Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.',
|
||||
} as const;
|
||||
|
||||
export const badRequestResponse = {
|
||||
description: 'The request data do not match what we expect.',
|
||||
const badRequestResponse = {
|
||||
description: 'The request data does not match what we expect.',
|
||||
} as const;
|
||||
|
||||
const standardResponses = {
|
||||
|
@ -12,7 +12,8 @@ import {
|
||||
UPDATE_ADDON,
|
||||
} from '../../types/permissions';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { AddonSchema, addonSchema } from '../../openapi/spec/addon-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
|
@ -18,7 +18,8 @@ import { ApiTokenType, IApiToken } from '../../types/models/api-token';
|
||||
import { createApiToken } from '../../schema/api-token-schema';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { IUnleashServices } from '../../types';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
apiTokensSchema,
|
||||
ApiTokensSchema,
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
} from '../../openapi/spec/features-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
|
||||
export default class ArchiveController extends Controller {
|
||||
|
@ -21,7 +21,7 @@ import { IProject } from '../../types/model';
|
||||
import { IUserPermission } from '../../types/stores/access-store';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
BootstrapUiSchema,
|
||||
bootstrapUiSchema,
|
||||
|
@ -5,7 +5,7 @@ import { IUnleashServices } from '../../types';
|
||||
import { Logger } from '../../logger';
|
||||
import ClientMetricsServiceV2 from '../../services/client-metrics/metrics-service-v2';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import {
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
SimpleAuthSettings,
|
||||
} from '../../types/settings/simple-auth-settings';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
uiConfigSchema,
|
||||
UiConfigSchema,
|
||||
|
@ -7,7 +7,7 @@ import { NONE } from '../../types/permissions';
|
||||
import Controller from '../controller';
|
||||
import { Logger } from '../../logger';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
|
||||
export default class ConstraintController extends Controller {
|
||||
private featureService: FeatureToggleService;
|
||||
|
@ -23,7 +23,8 @@ import {
|
||||
} from '../../openapi/spec/context-field-schema';
|
||||
import { ContextFieldsSchema } from '../../openapi/spec/context-fields-schema';
|
||||
import { UpsertContextFieldSchema } from '../../openapi/spec/upsert-context-field-schema';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import NotFoundError from '../../error/notfound-error';
|
||||
import { NameSchema } from '../../openapi/spec/name-schema';
|
||||
|
@ -6,7 +6,8 @@ import EnvironmentService from '../../services/environment-service';
|
||||
import { Logger } from '../../logger';
|
||||
import { ADMIN, NONE } from '../../types/permissions';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
environmentsSchema,
|
||||
EnvironmentsSchema,
|
||||
|
@ -7,8 +7,8 @@ import { IEvent } from '../../types/events';
|
||||
import Controller from '../controller';
|
||||
import { anonymise } from '../../util/anonymise';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createResponseSchema } from '../../../lib/openapi';
|
||||
import { endpointDescriptions } from '../../../lib/openapi/endpoint-descriptions';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { endpointDescriptions } from '../../openapi/endpoint-descriptions';
|
||||
import {
|
||||
eventsSchema,
|
||||
EventsSchema,
|
||||
|
@ -6,7 +6,7 @@ import { IUnleashConfig } from '../../types/option';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { FeatureTypesSchema } from '../../openapi/spec/feature-types-schema';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import Controller from '../controller';
|
||||
|
||||
const version = 1;
|
||||
|
@ -24,7 +24,8 @@ import { TagSchema } from '../../openapi/spec/tag-schema';
|
||||
import { TagsSchema } from '../../openapi/spec/tags-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
|
||||
const version = 1;
|
||||
|
@ -5,7 +5,8 @@ import { IUnleashConfig } from '../../types/option';
|
||||
import { IUnleashServices } from '../../types/services';
|
||||
import { Logger } from '../../logger';
|
||||
import ClientInstanceService from '../../services/client-metrics/instance-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { ApplicationSchema } from '../../openapi/spec/application-schema';
|
||||
import { ApplicationsSchema } from '../../openapi/spec/applications-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
|
@ -5,7 +5,7 @@ import { IUnleashServices } from '../../../types/services';
|
||||
import { Logger } from '../../../logger';
|
||||
import EnvironmentService from '../../../services/environment-service';
|
||||
import { UPDATE_PROJECT } from '../../../types/permissions';
|
||||
import { createRequestSchema } from '../../../openapi';
|
||||
import { createRequestSchema } from '../../../openapi/util/create-request-schema';
|
||||
import { ProjectEnvironmentSchema } from '../../../openapi/spec/project-environment-schema';
|
||||
import { emptyResponse } from '../../../openapi/util/standard-responses';
|
||||
|
||||
|
@ -33,7 +33,8 @@ import { UpdateFeatureStrategySchema } from '../../../openapi/spec/update-featur
|
||||
import { CreateFeatureStrategySchema } from '../../../openapi/spec/create-feature-strategy-schema';
|
||||
import { serializeDates } from '../../../types/serialize-dates';
|
||||
import { OpenApiService } from '../../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../../openapi';
|
||||
import { createRequestSchema } from '../../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../../openapi/util/create-response-schema';
|
||||
import { FeatureEnvironmentSchema } from '../../../openapi/spec/feature-environment-schema';
|
||||
import { emptyResponse } from '../../../openapi/util/standard-responses';
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { Logger } from '../../../logger';
|
||||
import { IArchivedQuery, IProjectParam } from '../../../types/model';
|
||||
import { NONE } from '../../../types/permissions';
|
||||
import { OpenApiService } from '../../../services/openapi-service';
|
||||
import { createResponseSchema } from '../../../openapi';
|
||||
import { createResponseSchema } from '../../../openapi/util/create-response-schema';
|
||||
import {
|
||||
healthOverviewSchema,
|
||||
HealthOverviewSchema,
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
} from '../../../openapi/spec/projects-schema';
|
||||
import { OpenApiService } from '../../../services/openapi-service';
|
||||
import { serializeDates } from '../../../types/serialize-dates';
|
||||
import { createResponseSchema } from '../../../openapi';
|
||||
import { createResponseSchema } from '../../../openapi/util/create-response-schema';
|
||||
|
||||
export default class ProjectApi extends Controller {
|
||||
private projectService: ProjectService;
|
||||
|
@ -10,7 +10,8 @@ import { IVariant } from '../../../types/model';
|
||||
import { extractUsername } from '../../../util/extract-user';
|
||||
import { IAuthRequest } from '../../unleash-types';
|
||||
import { FeatureVariantsSchema } from '../../../openapi/spec/feature-variants-schema';
|
||||
import { createRequestSchema, createResponseSchema } from '../../../openapi';
|
||||
import { createRequestSchema } from '../../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../../openapi/util/create-response-schema';
|
||||
|
||||
const PREFIX = '/:projectId/features/:featureName/variants';
|
||||
|
||||
|
@ -12,7 +12,8 @@ import { Logger } from '../../logger';
|
||||
import StateService from '../../services/state-service';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { ExportParametersSchema } from '../../openapi/spec/export-parameters-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
|
||||
|
@ -13,7 +13,9 @@ import {
|
||||
import { Request, Response } from 'express';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
strategySchema,
|
||||
StrategySchema,
|
||||
@ -23,7 +25,6 @@ import {
|
||||
StrategiesSchema,
|
||||
} from '../../openapi/spec/strategies-schema';
|
||||
import { UpsertStrategySchema } from '../../openapi/spec/upsert-strategy-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
|
||||
const version = 1;
|
||||
|
||||
|
@ -12,7 +12,8 @@ import { IUnleashServices } from '../../types/services';
|
||||
import TagTypeService from '../../services/tag-type-service';
|
||||
import { Logger } from '../../logger';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { TagTypesSchema } from '../../openapi/spec/tag-types-schema';
|
||||
import { ValidateTagTypeSchema } from '../../openapi/spec/validate-tag-type-schema';
|
||||
import {
|
||||
|
@ -9,7 +9,8 @@ import Controller from '../controller';
|
||||
import { NONE, UPDATE_FEATURE } from '../../types/permissions';
|
||||
import { extractUsername } from '../../util/extract-user';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { tagsSchema, TagsSchema } from '../../openapi/spec/tags-schema';
|
||||
import { TagSchema } from '../../openapi/spec/tag-schema';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
|
@ -14,7 +14,8 @@ import { IUser, SimpleAuthSettings } from '../../server-impl';
|
||||
import { simpleAuthKey } from '../../types/settings/simple-auth-settings';
|
||||
import { anonymise } from '../../util/anonymise';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { userSchema, UserSchema } from '../../openapi/spec/user-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import { usersSchema, UsersSchema } from '../../openapi/spec/users-schema';
|
||||
|
@ -13,7 +13,8 @@ import {
|
||||
} from '../../openapi/spec/feedback-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import { parseISO } from 'date-fns';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import BadDataError from '../../error/bad-data-error';
|
||||
|
||||
class UserFeedbackController extends Controller {
|
||||
|
@ -7,7 +7,7 @@ import UserSplashService from '../../services/user-splash-service';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { splashSchema, SplashSchema } from '../../openapi/spec/splash-schema';
|
||||
|
||||
class UserSplashController extends Controller {
|
||||
|
@ -9,7 +9,8 @@ import UserFeedbackService from '../../services/user-feedback-service';
|
||||
import UserSplashService from '../../services/user-splash-service';
|
||||
import { ADMIN, NONE } from '../../types/permissions';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { meSchema, MeSchema } from '../../openapi/spec/me-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
import { IUserPermission } from '../../types/stores/access-store';
|
||||
|
@ -5,7 +5,8 @@ import { Logger } from '../../logger';
|
||||
import { IUnleashConfig } from '../../types/option';
|
||||
import { IUnleashServices } from '../../types';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import {
|
||||
tokenUserSchema,
|
||||
|
@ -7,7 +7,8 @@ import { IUnleashServices } from '../../types';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import Controller from '../controller';
|
||||
import { IAuthRequest } from '../unleash-types';
|
||||
import { createRequestSchema, createResponseSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { userSchema, UserSchema } from '../../openapi/spec/user-schema';
|
||||
import { LoginSchema } from '../../openapi/spec/login-schema';
|
||||
import { serializeDates } from '../../types/serialize-dates';
|
||||
|
@ -15,7 +15,7 @@ import { FeatureConfigurationClient } from '../../types/stores/feature-strategie
|
||||
import { ClientSpecService } from '../../services/client-spec-service';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { createResponseSchema } from '../../openapi';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import { ClientFeaturesQuerySchema } from '../../openapi/spec/client-features-query-schema';
|
||||
import {
|
||||
clientFeatureSchema,
|
||||
|
@ -11,7 +11,7 @@ import { User } from '../../server-impl';
|
||||
import { IClientApp } from '../../types/model';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema } from '../../openapi';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import {
|
||||
emptyResponse,
|
||||
getStandardResponses,
|
||||
|
@ -10,9 +10,9 @@ import ApiUser from '../../types/api-user';
|
||||
import { ALL } from '../../types/models/api-token';
|
||||
import { NONE } from '../../types/permissions';
|
||||
import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema } from '../../openapi';
|
||||
import { ClientApplicationSchema } from '../../openapi/spec/client-application-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { ClientApplicationSchema } from '../../openapi/spec/client-application-schema';
|
||||
|
||||
export default class RegisterController extends Controller {
|
||||
logger: Logger;
|
||||
|
@ -7,7 +7,7 @@ import { OpenApiService } from '../services/openapi-service';
|
||||
|
||||
import Controller from './controller';
|
||||
import { NONE } from '../types/permissions';
|
||||
import { createResponseSchema } from '../openapi';
|
||||
import { createResponseSchema } from '../openapi/util/create-response-schema';
|
||||
import { HealthCheckSchema } from '../openapi/spec/health-check-schema';
|
||||
|
||||
export class HealthCheckController extends Controller {
|
||||
|
@ -2,12 +2,12 @@ import openapi, { IExpressOpenApi } from '@unleash/express-openapi';
|
||||
import { Express, RequestHandler, Response } from 'express';
|
||||
import { IUnleashConfig } from '../types/option';
|
||||
import {
|
||||
ApiOperation,
|
||||
createOpenApiSchema,
|
||||
JsonSchemaProps,
|
||||
removeJsonSchemaProps,
|
||||
SchemaId,
|
||||
} from '../openapi';
|
||||
import { ApiOperation } from '../openapi/util/api-operation';
|
||||
import { Logger } from '../logger';
|
||||
import { validateSchema } from '../openapi/validate';
|
||||
|
||||
|
@ -2661,7 +2661,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -2800,7 +2800,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -2832,7 +2832,7 @@ Object {
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -2907,7 +2907,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -2930,7 +2930,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3059,7 +3059,7 @@ Object {
|
||||
},
|
||||
"responses": Object {
|
||||
"201": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3083,7 +3083,7 @@ Object {
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3106,7 +3106,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3166,7 +3166,7 @@ Object {
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3179,7 +3179,7 @@ Object {
|
||||
"operationId": "getAllEnvironments",
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3203,7 +3203,7 @@ Object {
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3256,7 +3256,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"204": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3279,7 +3279,7 @@ Object {
|
||||
],
|
||||
"responses": Object {
|
||||
"204": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3405,7 +3405,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
"operationId": "validateFeature",
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3513,7 +3513,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3628,7 +3628,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3688,7 +3688,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"202": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3772,7 +3772,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3803,7 +3803,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -3903,7 +3903,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4368,7 +4368,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4787,7 +4787,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"202": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4829,7 +4829,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"201": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4852,7 +4852,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4914,7 +4914,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4937,7 +4937,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -4960,7 +4960,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5063,7 +5063,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5123,7 +5123,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5165,7 +5165,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"201": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5226,7 +5226,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5446,7 +5446,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5469,7 +5469,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
],
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5570,7 +5570,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5594,7 +5594,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
"400": Object {
|
||||
"description": "passwordMismatch",
|
||||
@ -5671,10 +5671,10 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"202": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
"400": Object {
|
||||
"description": "The request data do not match what we expect.",
|
||||
"description": "The request data does not match what we expect.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5698,7 +5698,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"202": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5722,7 +5722,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5746,7 +5746,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
@ -5790,7 +5790,7 @@ If the provided project does not exist, the list of events will be empty.",
|
||||
},
|
||||
"responses": Object {
|
||||
"200": Object {
|
||||
"description": "emptyResponse",
|
||||
"description": "This response has no body.",
|
||||
},
|
||||
},
|
||||
"tags": Array [
|
||||
|
Loading…
Reference in New Issue
Block a user