mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
6cc51b7ba0
Adding documentation for the edge endpoints. Also separating request and response schema for our validate endpoint to make clear that we expect a list of strings as input, but yield tokens as output. --------- Co-authored-by: Gastón Fournier <gaston@getunleash.io> Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { dateSchema } from './date-schema';
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
export const clientMetricsEnvSchema = {
|
|
$id: '#/components/schemas/clientMetricsEnvSchema',
|
|
type: 'object',
|
|
required: ['featureName', 'appName', 'environment'],
|
|
additionalProperties: true,
|
|
description: 'Used for reporting feature evaluation results from SDKs',
|
|
properties: {
|
|
featureName: {
|
|
type: 'string',
|
|
description: 'Name of the feature checked by the SDK',
|
|
example: 'my.special.feature',
|
|
},
|
|
appName: {
|
|
description: 'The name of the application the SDK is being used in',
|
|
type: 'string',
|
|
example: 'accounting',
|
|
},
|
|
environment: {
|
|
description: 'Which environment the SDK is being used in',
|
|
type: 'string',
|
|
example: 'development',
|
|
},
|
|
timestamp: {
|
|
description:
|
|
'The start of the time window these metrics are valid for. The window is 1 hour wide',
|
|
example: '1926-05-08T12:00:00.000Z',
|
|
$ref: '#/components/schemas/dateSchema',
|
|
},
|
|
yes: {
|
|
description: 'How many times the toggle evaluated to true',
|
|
type: 'number',
|
|
example: 974,
|
|
},
|
|
no: {
|
|
description: 'How many times the toggle evaluated to false',
|
|
type: 'number',
|
|
example: 50,
|
|
},
|
|
variants: {
|
|
description: 'How many times each variant was returned',
|
|
type: 'object',
|
|
additionalProperties: {
|
|
type: 'integer',
|
|
minimum: 0,
|
|
},
|
|
example: {
|
|
variantA: 15,
|
|
variantB: 25,
|
|
variantC: 5,
|
|
},
|
|
},
|
|
},
|
|
components: {
|
|
schemas: {
|
|
dateSchema,
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export type ClientMetricsSchema = FromSchema<typeof clientMetricsEnvSchema>;
|