1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

chore: start validating getFeature endpoint (#10975)

This commit is contained in:
Jaanus Sellin 2025-11-14 08:47:31 +02:00 committed by GitHub
parent 06b9d1939b
commit 9de82e87f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 5 deletions

View File

@ -742,11 +742,15 @@ export default class ProjectFeaturesController extends Controller {
userId: user.id, userId: user.id,
}); });
const maybeAnonymized = this.maybeAnonymise(feature); const maybeAnonymized = this.maybeAnonymise(feature);
res.status(200).json( const responseData = {
serializeDates({ ...maybeAnonymized,
...maybeAnonymized, stale: maybeAnonymized.stale || false,
stale: maybeAnonymized.stale || false, };
}), this.openApiService.respondWithValidation(
200,
res,
featureSchema.$id,
serializeDates(responseData),
); );
} }

View File

@ -120,6 +120,20 @@ export const featureEnvironmentSchema = {
$ref: '#/components/schemas/releasePlanSchema', $ref: '#/components/schemas/releasePlanSchema',
}, },
}, },
yes: {
type: 'integer',
description:
'How many times the feature evaluated to true (enabled)',
example: 974,
minimum: 0,
},
no: {
type: 'integer',
description:
'How many times the feature evaluated to false (disabled)',
example: 50,
minimum: 0,
},
}, },
components: { components: {
schemas: { schemas: {

View File

@ -181,6 +181,13 @@ export const featureSchema = {
], ],
example: 'initial', example: 'initial',
}, },
status: {
type: 'string',
nullable: true,
example: 'kept',
description:
'The name of the detailed status of a given stage. E.g. completed stage can be kept or discarded.',
},
enteredStageAt: { enteredStageAt: {
description: 'When the feature entered this stage', description: 'When the feature entered this stage',
type: 'string', type: 'string',
@ -281,6 +288,12 @@ export const featureSchema = {
description: 'The description of the link', description: 'The description of the link',
nullable: true, nullable: true,
}, },
feature: {
type: 'string',
example: 'disable-comments',
description:
'The name of the feature this link belongs to',
},
}, },
}, },
description: description: