2022-07-12 13:01:10 +02:00
|
|
|
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',
|
2023-01-05 11:57:53 +01:00
|
|
|
additionalProperties: true,
|
2022-07-12 13:01:10 +02:00
|
|
|
required: ['appName'],
|
|
|
|
properties: {
|
|
|
|
appName: {
|
|
|
|
type: 'string',
|
|
|
|
minLength: 1,
|
2022-07-28 09:19:58 +02:00
|
|
|
example: 'My cool application.',
|
2023-06-14 11:05:08 +02:00
|
|
|
description: 'The name of the application.',
|
2022-07-12 13:01:10 +02:00
|
|
|
},
|
|
|
|
currentTime: {
|
|
|
|
type: 'string',
|
|
|
|
format: 'date-time',
|
2022-07-28 09:19:58 +02:00
|
|
|
example: '2022-07-05T12:56:41+02:00',
|
2023-06-14 11:05:08 +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.',
|
2022-07-12 13:01:10 +02:00
|
|
|
},
|
|
|
|
properties: {
|
|
|
|
type: 'object',
|
|
|
|
additionalProperties: { type: 'string' },
|
2022-07-28 09:19:58 +02:00
|
|
|
example: {
|
|
|
|
customContextField: 'this is one!',
|
|
|
|
otherCustomField: '3',
|
|
|
|
},
|
2022-07-12 13:01:10 +02:00
|
|
|
},
|
|
|
|
remoteAddress: {
|
|
|
|
type: 'string',
|
2022-07-28 09:19:58 +02:00
|
|
|
example: '192.168.1.1',
|
2023-06-14 11:05:08 +02:00
|
|
|
description: "The app's IP address",
|
2022-07-12 13:01:10 +02:00
|
|
|
},
|
|
|
|
sessionId: {
|
|
|
|
type: 'string',
|
2022-07-28 09:19:58 +02:00
|
|
|
example: 'b65e7b23-fec0-4814-a129-0e9861ef18fc',
|
2023-06-14 11:05:08 +02:00
|
|
|
description: 'An identifier for the current session',
|
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
type: 'string',
|
|
|
|
example: 'username@provider.com',
|
|
|
|
description: 'An identifier for the current user',
|
2022-07-12 13:01:10 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type SdkContextSchema = FromSchema<typeof sdkContextSchema>;
|