1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00

feat: filter out all data fields other than explicit openapi fields (#3284)

Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
This commit is contained in:
Mateusz Kwasniewski 2023-03-09 14:45:03 +01:00 committed by GitHub
parent f0bfa16ec2
commit b05b075ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 4 deletions

View File

@ -49,6 +49,7 @@ export const clientFeatureSchema = {
items: {
$ref: '#/components/schemas/featureStrategySchema',
},
deprecated: true,
},
variants: {
type: 'array',
@ -56,6 +57,7 @@ export const clientFeatureSchema = {
$ref: '#/components/schemas/variantSchema',
},
nullable: true,
deprecated: true,
},
},
components: {

View File

@ -81,7 +81,7 @@ export default class FeatureController extends Controller {
operationId: 'getClientFeature',
tags: ['Client'],
responses: {
200: createResponseSchema('clientFeaturesSchema'),
200: createResponseSchema('clientFeatureSchema'),
},
}),
],

View File

@ -688,7 +688,37 @@ class FeatureToggleService {
query?: IFeatureToggleQuery,
includeIds?: boolean,
): Promise<FeatureConfigurationClient[]> {
return this.featureToggleClientStore.getClient(query, includeIds);
const result = await this.featureToggleClientStore.getClient(
query,
includeIds,
);
return result.map(
({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}) => ({
name,
type,
enabled,
project,
stale,
strategies,
variants,
description,
createdAt,
lastSeenAt,
impressionData,
}),
);
}
/**

View File

@ -489,6 +489,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"type": "boolean",
},
"strategies": {
"deprecated": true,
"items": {
"$ref": "#/components/schemas/featureStrategySchema",
},
@ -498,6 +499,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"type": "string",
},
"variants": {
"deprecated": true,
"items": {
"$ref": "#/components/schemas/variantSchema",
},
@ -8567,11 +8569,11 @@ If the provided project does not exist, the list of events will be empty.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/clientFeaturesSchema",
"$ref": "#/components/schemas/clientFeatureSchema",
},
},
},
"description": "clientFeaturesSchema",
"description": "clientFeatureSchema",
},
},
"tags": [