mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
Refactor: rename request-parameters -> query-parameters
This commit is contained in:
parent
25241b431e
commit
f591feec86
@ -3,12 +3,12 @@ import fc, { Arbitrary } from 'fast-check';
|
|||||||
import { OpenAPIV3 } from 'openapi-types';
|
import { OpenAPIV3 } from 'openapi-types';
|
||||||
import { urlFriendlyString } from '../../../test/arbitraries.test';
|
import { urlFriendlyString } from '../../../test/arbitraries.test';
|
||||||
import {
|
import {
|
||||||
createRequestParameters,
|
createQueryParameters,
|
||||||
ParameterDetails,
|
ParameterDetails,
|
||||||
Parameters,
|
Parameters,
|
||||||
ParameterType,
|
ParameterType,
|
||||||
toParamObject,
|
toParamObject,
|
||||||
} from './request-parameters';
|
} from './query-parameters';
|
||||||
|
|
||||||
const paramName = urlFriendlyString;
|
const paramName = urlFriendlyString;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ describe('request parameter utils', () => {
|
|||||||
it('turns an object of names and descriptions into a an expected parameter list', () => {
|
it('turns an object of names and descriptions into a an expected parameter list', () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(parameterDetails(), fc.context(), (parameters, ctx) => {
|
fc.property(parameterDetails(), fc.context(), (parameters, ctx) => {
|
||||||
const result = createRequestParameters(parameters);
|
const result = createQueryParameters(parameters);
|
||||||
|
|
||||||
ctx.log(JSON.stringify(result));
|
ctx.log(JSON.stringify(result));
|
||||||
|
|
@ -31,7 +31,7 @@ export const toParamObject = (
|
|||||||
in: 'query',
|
in: 'query',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createRequestParameters = (params: {
|
export const createQueryParameters = (params: {
|
||||||
[parameterName: string]: ParameterDetails<unknown>;
|
[parameterName: string]: ParameterDetails<unknown>;
|
||||||
}): OpenAPIV3.ParameterObject[] =>
|
}): OpenAPIV3.ParameterObject[] =>
|
||||||
Object.entries(params).map(([name, deets]) => toParamObject(name, deets));
|
Object.entries(params).map(([name, deets]) => toParamObject(name, deets));
|
@ -19,7 +19,7 @@ import {
|
|||||||
ExportParametersSchema,
|
ExportParametersSchema,
|
||||||
} from '../../openapi/spec/export-parameters-schema';
|
} from '../../openapi/spec/export-parameters-schema';
|
||||||
import { emptyResponse } from '../../openapi/util/standard-responses';
|
import { emptyResponse } from '../../openapi/util/standard-responses';
|
||||||
import { createRequestParameters } from '../../openapi/util/request-parameters';
|
import { createQueryParameters } from '../../openapi/util/query-parameters';
|
||||||
|
|
||||||
const upload = multer({ limits: { fileSize: 5242880 } });
|
const upload = multer({ limits: { fileSize: 5242880 } });
|
||||||
const paramToBool = (param, def) => {
|
const paramToBool = (param, def) => {
|
||||||
@ -79,7 +79,7 @@ class StateController extends Controller {
|
|||||||
responses: {
|
responses: {
|
||||||
200: createResponseSchema('stateSchema'),
|
200: createResponseSchema('stateSchema'),
|
||||||
},
|
},
|
||||||
parameters: createRequestParameters(exportParameters),
|
parameters: createQueryParameters(exportParameters),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user