mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-12 01:17:04 +02:00
Feat: add query params to state
This commit is contained in:
parent
2594f0051a
commit
c9ce6a6067
@ -1,31 +1,47 @@
|
||||
import { FromSchema } from 'json-schema-to-ts';
|
||||
import { Parameters } from '../util/request-parameters';
|
||||
|
||||
const exportParameters = {
|
||||
export const exportParameters: Parameters = {
|
||||
format: {
|
||||
type: 'string',
|
||||
enum: ['json', 'yaml'],
|
||||
default: 'json',
|
||||
description: '',
|
||||
description: 'Desired export format. Must be either `json` or `yaml`.',
|
||||
},
|
||||
download: {
|
||||
type: 'boolean',
|
||||
default: 'false',
|
||||
description: '',
|
||||
default: false,
|
||||
description: 'Whether exported data should be downloaded as a file.',
|
||||
},
|
||||
strategies: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether strategies should be included in the exported data.',
|
||||
},
|
||||
featureToggles: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether feature toggles should be included in the exported data.',
|
||||
},
|
||||
projects: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether projects should be included in the exported data.',
|
||||
},
|
||||
tags: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether tag types, tags, and feature_tags should be included in the exported data.',
|
||||
},
|
||||
environments: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description:
|
||||
'Whether environments should be included in the exported data.',
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,8 @@ describe('request parameter utils', () => {
|
||||
result.description === details.description &&
|
||||
result.example === details.example &&
|
||||
schema.enum === details.enum &&
|
||||
schema.default === details.default
|
||||
schema.default === details.default &&
|
||||
result.required === details.required
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -5,6 +5,7 @@ export type ParameterType = OpenAPIV3.NonArraySchemaObjectType;
|
||||
export type ParameterDetails<U> = {
|
||||
description: string;
|
||||
type: ParameterType;
|
||||
required?: boolean;
|
||||
default?: U;
|
||||
enum?: [U, ...U[]];
|
||||
example?: U;
|
||||
@ -21,6 +22,7 @@ export const toParamObject = (
|
||||
name,
|
||||
example: details.example,
|
||||
description: details.description,
|
||||
required: details.required,
|
||||
schema: {
|
||||
type: details.type,
|
||||
enum: details.enum,
|
||||
|
@ -15,11 +15,11 @@ import { OpenApiService } from '../../services/openapi-service';
|
||||
import { createRequestSchema } from '../../openapi/util/create-request-schema';
|
||||
import { createResponseSchema } from '../../openapi/util/create-response-schema';
|
||||
import {
|
||||
exportParametersSchema,
|
||||
exportParameters,
|
||||
ExportParametersSchema,
|
||||
} from '../../openapi/spec/export-parameters-schema';
|
||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||
import { createRequestParameters } from 'lib/openapi/util/request-parameters';
|
||||
import { createRequestParameters } from '../../openapi/util/request-parameters';
|
||||
|
||||
const upload = multer({ limits: { fileSize: 5242880 } });
|
||||
const paramToBool = (param, def) => {
|
||||
@ -79,7 +79,7 @@ class StateController extends Controller {
|
||||
responses: {
|
||||
200: createResponseSchema('stateSchema'),
|
||||
},
|
||||
// parameters: createRequestParameters(exportParametersSchema),
|
||||
parameters: createRequestParameters(exportParameters),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user