1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/src/lib/openapi/spec/sdk-context-schema.ts
Fredrik Strand Oseberg 99308a7054
fix: add additionalproperties to the sdkContextSchema (#4682)
This was changed a month ago, but it ends up breaking the frontend when
we regenerate the types because the playground needs to have this
structure for now. We'll need to add this back until we can rewrite the
playground to follow the schema.
2023-09-13 12:39:36 +02:00

57 lines
1.8 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const sdkContextSchema = {
$id: '#/components/schemas/sdkContextSchema',
description: 'The Unleash context as modeled in client SDKs',
type: 'object',
required: ['appName'],
additionalProperties: true,
properties: {
appName: {
type: 'string',
minLength: 1,
example: 'My cool application.',
description: 'The name of the application.',
},
currentTime: {
type: 'string',
format: 'date-time',
example: '2022-07-05T12:56:41+02:00',
description:
'A DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.',
},
environment: {
type: 'string',
deprecated: true,
description: 'The environment the app is running in.',
},
properties: {
type: 'object',
additionalProperties: { type: 'string' },
description: 'Additional Unleash context properties',
example: {
customContextField: 'this is one!',
otherCustomField: '3',
},
},
remoteAddress: {
type: 'string',
example: '192.168.1.1',
description: "The app's IP address",
},
sessionId: {
type: 'string',
example: 'b65e7b23-fec0-4814-a129-0e9861ef18fc',
description: 'An identifier for the current session',
},
userId: {
type: 'string',
example: 'username@provider.com',
description: 'An identifier for the current user',
},
},
components: {},
} as const;
export type SdkContextSchema = FromSchema<typeof sdkContextSchema>;