1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +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: { items: {
$ref: '#/components/schemas/featureStrategySchema', $ref: '#/components/schemas/featureStrategySchema',
}, },
deprecated: true,
}, },
variants: { variants: {
type: 'array', type: 'array',
@ -56,6 +57,7 @@ export const clientFeatureSchema = {
$ref: '#/components/schemas/variantSchema', $ref: '#/components/schemas/variantSchema',
}, },
nullable: true, nullable: true,
deprecated: true,
}, },
}, },
components: { components: {

View File

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

View File

@ -688,7 +688,37 @@ class FeatureToggleService {
query?: IFeatureToggleQuery, query?: IFeatureToggleQuery,
includeIds?: boolean, includeIds?: boolean,
): Promise<FeatureConfigurationClient[]> { ): 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", "type": "boolean",
}, },
"strategies": { "strategies": {
"deprecated": true,
"items": { "items": {
"$ref": "#/components/schemas/featureStrategySchema", "$ref": "#/components/schemas/featureStrategySchema",
}, },
@ -498,6 +499,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"type": "string", "type": "string",
}, },
"variants": { "variants": {
"deprecated": true,
"items": { "items": {
"$ref": "#/components/schemas/variantSchema", "$ref": "#/components/schemas/variantSchema",
}, },
@ -8567,11 +8569,11 @@ If the provided project does not exist, the list of events will be empty.",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/clientFeaturesSchema", "$ref": "#/components/schemas/clientFeatureSchema",
}, },
}, },
}, },
"description": "clientFeaturesSchema", "description": "clientFeatureSchema",
}, },
}, },
"tags": [ "tags": [