From 8cd89bb5a7c5d3c291471dae4cf3a887afb27005 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 22 Jun 2023 11:52:21 +0200 Subject: [PATCH] chore: update orval models (#4062) Updates orval model based on the current enterprise changes. Mostly doc/comment changes, but does introduce the new strategySchemaLinks model. --- .../AdvancedPlaygroundResultsTable.test.tsx | 6 ++++++ .../openapi/models/clientApplicationSchema.ts | 13 +++++++++++++ .../models/clientApplicationSchemaStarted.ts | 3 +++ .../src/openapi/models/clientFeatureSchema.ts | 16 ++++++++++++---- .../openapi/models/clientFeaturesQuerySchema.ts | 14 ++++++++++++++ .../src/openapi/models/clientFeaturesSchema.ts | 7 +++++++ .../models/clientMetricsSchemaBucketToggles.ts | 2 +- .../clientMetricsSchemaBucketTogglesVariants.ts | 2 +- .../src/openapi/models/featureStrategySchema.ts | 2 +- frontend/src/openapi/models/index.ts | 1 + frontend/src/openapi/models/overrideSchema.ts | 5 +++++ .../openapi/models/playgroundStrategySchema.ts | 3 +++ .../models/playgroundStrategySchemaLinks.ts | 12 ++++++++++++ frontend/src/openapi/models/variantSchema.ts | 9 +++++++++ .../src/openapi/models/variantSchemaPayload.ts | 3 +++ 15 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 frontend/src/openapi/models/playgroundStrategySchemaLinks.ts diff --git a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx index a7eab1e90f..841300a1a0 100644 --- a/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx +++ b/frontend/src/component/playground/Playground/AdvancedPlaygroundResultsTable/AdvancedPlaygroundResultsTable.test.tsx @@ -36,6 +36,9 @@ test('should render advanced playground table', async () => { }, constraints: [], segments: [], + links: { + edit: '/projects/ChangeReqs/features/Infinite/strategies/edit?environmenId=development&strategyId=45971fe0-1122-40a7-a68c-3a1430c44062', + }, }, { name: 'default', @@ -49,6 +52,9 @@ test('should render advanced playground table', async () => { }, constraints: [], segments: [], + links: { + edit: '/projects/ChangeReqs/features/Infinite/strategies/edit?environmenId=development&strategyId=bf5e35b6-edc1-4e54-8f7e-a6cc8d4f352a', + }, }, ], }, diff --git a/frontend/src/openapi/models/clientApplicationSchema.ts b/frontend/src/openapi/models/clientApplicationSchema.ts index c1214461cc..569fdbe45e 100644 --- a/frontend/src/openapi/models/clientApplicationSchema.ts +++ b/frontend/src/openapi/models/clientApplicationSchema.ts @@ -5,12 +5,25 @@ */ import type { ClientApplicationSchemaStarted } from './clientApplicationSchemaStarted'; +/** + * A client application is an instance of one of our SDKs + */ export interface ClientApplicationSchema { + /** An identifier for the app that uses the sdk, should be static across SDK restarts */ appName: string; + /** A unique identifier identifying the instance of the application running the SDK. Often changes based on execution environment. For instance: two pods in Kubernetes will have two different instanceIds */ instanceId?: string; + /** An SDK version identifier. Usually formatted as "unleash-client-:" */ sdkVersion?: string; + /** + * The SDK's configured 'environment' property. Deprecated. This property does **not** control which Unleash environment the SDK gets toggles for. To control Unleash environments, use the SDKs API key. + * @deprecated + */ environment?: string; + /** How often (in seconds) does the client refresh its toggles */ interval: number; + /** Either an RFC-3339 timestamp or a unix timestamp in seconds */ started: ClientApplicationSchemaStarted; + /** Which strategies the SDKs runtime knows about */ strategies: string[]; } diff --git a/frontend/src/openapi/models/clientApplicationSchemaStarted.ts b/frontend/src/openapi/models/clientApplicationSchemaStarted.ts index bd519719b6..6185bc483c 100644 --- a/frontend/src/openapi/models/clientApplicationSchemaStarted.ts +++ b/frontend/src/openapi/models/clientApplicationSchemaStarted.ts @@ -4,4 +4,7 @@ * See `gen:api` script in package.json */ +/** + * Either an RFC-3339 timestamp or a unix timestamp in seconds + */ export type ClientApplicationSchemaStarted = string | number; diff --git a/frontend/src/openapi/models/clientFeatureSchema.ts b/frontend/src/openapi/models/clientFeatureSchema.ts index 867a86414a..548034fdd8 100644 --- a/frontend/src/openapi/models/clientFeatureSchema.ts +++ b/frontend/src/openapi/models/clientFeatureSchema.ts @@ -6,18 +6,26 @@ import type { FeatureStrategySchema } from './featureStrategySchema'; import type { VariantSchema } from './variantSchema'; +/** + * Feature toggle configuration used by SDKs to evaluate state of a toggle + */ export interface ClientFeatureSchema { + /** The unique name of a feature toggle. Is validated to be URL safe on creation */ name: string; + /** What kind of feature flag is this. Refer to the documentation on [feature toggle types](https://docs.getunleash.io/reference/feature-toggle-types) for more information */ type?: string; + /** A description of the toggle */ description?: string | null; - createdAt?: string | null; - lastSeenAt?: string | null; + /** Whether the feature flag is enabled for the current API key or not. This is ANDed with the evaluation results of the strategies list, so if this is false, the evaluation result will always be false */ enabled: boolean; + /** If this is true Unleash believes this feature toggle has been active longer than Unleash expects a toggle of this type to be active */ stale?: boolean; + /** Set to true if SDKs should trigger [impression events](https://docs.getunleash.io/reference/impression-data) when this toggle is evaluated */ impressionData?: boolean | null; + /** Which project this feature toggle belongs to */ project?: string; - /** @deprecated */ + /** Evaluation strategies for this toggle. Each entry in this list will be evaluated and ORed together */ strategies?: FeatureStrategySchema[]; - /** @deprecated */ + /** [Variants](https://docs.getunleash.io/reference/feature-toggle-variants#what-are-variants) configured for this toggle */ variants?: VariantSchema[] | null; } diff --git a/frontend/src/openapi/models/clientFeaturesQuerySchema.ts b/frontend/src/openapi/models/clientFeaturesQuerySchema.ts index b81623952c..45b6052948 100644 --- a/frontend/src/openapi/models/clientFeaturesQuerySchema.ts +++ b/frontend/src/openapi/models/clientFeaturesQuerySchema.ts @@ -4,10 +4,24 @@ * See `gen:api` script in package.json */ +/** + * Query parameters active for a client features request + */ export interface ClientFeaturesQuerySchema { + /** Features tagged with one of these tags are included */ tag?: string[][]; + /** + * Features that are part of these projects are included in this response. (DEPRECATED) - Handled by API tokens + * @deprecated + */ project?: string[]; + /** Features are filtered to only include features whose name starts with this prefix */ namePrefix?: string; + /** + * Strategies for the feature toggle configured for this environment are included. (DEPRECATED) - Handled by API tokens + * @deprecated + */ environment?: string; + /** Set to true if requesting client does not support Unleash-Client-Specification 4.2.2 or newer. Modern SDKs will have this set to false, since they will be able to merge constraints and segments themselves */ inlineSegmentConstraints?: boolean; } diff --git a/frontend/src/openapi/models/clientFeaturesSchema.ts b/frontend/src/openapi/models/clientFeaturesSchema.ts index 0e94ee4dd7..b986324f3c 100644 --- a/frontend/src/openapi/models/clientFeaturesSchema.ts +++ b/frontend/src/openapi/models/clientFeaturesSchema.ts @@ -7,9 +7,16 @@ import type { ClientFeatureSchema } from './clientFeatureSchema'; import type { SegmentSchema } from './segmentSchema'; import type { ClientFeaturesQuerySchema } from './clientFeaturesQuerySchema'; +/** + * Configuration data for server-side SDKs for evaluating feature flags. + */ export interface ClientFeaturesSchema { + /** A version number for the format used in the response. Most Unleash instances now return version 2, which includes segments as a separate array */ version: number; + /** A list of feature toggles with their configuration */ features: ClientFeatureSchema[]; + /** A list of [Segments](https://docs.getunleash.io/reference/segments) configured for this Unleash instance */ segments?: SegmentSchema[]; + /** A summary of filters and parameters sent to the endpoint. Used by the server to build the features and segments response */ query?: ClientFeaturesQuerySchema; } diff --git a/frontend/src/openapi/models/clientMetricsSchemaBucketToggles.ts b/frontend/src/openapi/models/clientMetricsSchemaBucketToggles.ts index 105a326af4..34809e4d42 100644 --- a/frontend/src/openapi/models/clientMetricsSchemaBucketToggles.ts +++ b/frontend/src/openapi/models/clientMetricsSchemaBucketToggles.ts @@ -14,7 +14,7 @@ export type ClientMetricsSchemaBucketToggles = { yes?: number; /** How many times the toggle evaluated to false */ no?: number; - /** How many times each variant was returned */ + /** An object describing how many times each variant was returned. Variant names are used as properties, and the number of times they were exposed is the corresponding value (i.e. `{ [variantName]: number }`). */ variants?: ClientMetricsSchemaBucketTogglesVariants; }; }; diff --git a/frontend/src/openapi/models/clientMetricsSchemaBucketTogglesVariants.ts b/frontend/src/openapi/models/clientMetricsSchemaBucketTogglesVariants.ts index ba8224f5f9..d1209ce9b5 100644 --- a/frontend/src/openapi/models/clientMetricsSchemaBucketTogglesVariants.ts +++ b/frontend/src/openapi/models/clientMetricsSchemaBucketTogglesVariants.ts @@ -5,7 +5,7 @@ */ /** - * How many times each variant was returned + * An object describing how many times each variant was returned. Variant names are used as properties, and the number of times they were exposed is the corresponding value (i.e. `{ [variantName]: number }`). */ export type ClientMetricsSchemaBucketTogglesVariants = { [key: string]: number; diff --git a/frontend/src/openapi/models/featureStrategySchema.ts b/frontend/src/openapi/models/featureStrategySchema.ts index ff1b62bddb..9de1dc5f35 100644 --- a/frontend/src/openapi/models/featureStrategySchema.ts +++ b/frontend/src/openapi/models/featureStrategySchema.ts @@ -7,7 +7,7 @@ import type { ConstraintSchema } from './constraintSchema'; import type { ParametersSchema } from './parametersSchema'; /** - * A singles activation strategy configuration schema for a feature + * A single activation strategy configuration schema for a feature */ export interface FeatureStrategySchema { /** A uuid for the feature strategy */ diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index b5783005d9..9dbab96e04 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -327,6 +327,7 @@ export * from './playgroundRequestSchemaProjects'; export * from './playgroundResponseSchema'; export * from './playgroundSegmentSchema'; export * from './playgroundStrategySchema'; +export * from './playgroundStrategySchemaLinks'; export * from './playgroundStrategySchemaResult'; export * from './playgroundStrategySchemaResultAnyOf'; export * from './playgroundStrategySchemaResultAnyOfEnabled'; diff --git a/frontend/src/openapi/models/overrideSchema.ts b/frontend/src/openapi/models/overrideSchema.ts index de18cf66ca..019996ab20 100644 --- a/frontend/src/openapi/models/overrideSchema.ts +++ b/frontend/src/openapi/models/overrideSchema.ts @@ -4,7 +4,12 @@ * See `gen:api` script in package.json */ +/** + * An override for deciding which variant should be assigned to a user based on the context name + */ export interface OverrideSchema { + /** The name of the context field used to determine overrides */ contextName: string; + /** Which values that should be overriden */ values: string[]; } diff --git a/frontend/src/openapi/models/playgroundStrategySchema.ts b/frontend/src/openapi/models/playgroundStrategySchema.ts index ea0bcb607f..066d5051c8 100644 --- a/frontend/src/openapi/models/playgroundStrategySchema.ts +++ b/frontend/src/openapi/models/playgroundStrategySchema.ts @@ -7,6 +7,7 @@ import type { PlaygroundStrategySchemaResult } from './playgroundStrategySchemaR import type { PlaygroundSegmentSchema } from './playgroundSegmentSchema'; import type { PlaygroundConstraintSchema } from './playgroundConstraintSchema'; import type { ParametersSchema } from './parametersSchema'; +import type { PlaygroundStrategySchemaLinks } from './playgroundStrategySchemaLinks'; export interface PlaygroundStrategySchema { /** The strategy's name. */ @@ -25,4 +26,6 @@ export interface PlaygroundStrategySchema { constraints: PlaygroundConstraintSchema[]; /** The strategy's constraints and their evaluation results. */ parameters: ParametersSchema; + /** A set of links to actions you can perform on this strategy */ + links: PlaygroundStrategySchemaLinks; } diff --git a/frontend/src/openapi/models/playgroundStrategySchemaLinks.ts b/frontend/src/openapi/models/playgroundStrategySchemaLinks.ts new file mode 100644 index 0000000000..92173bbebf --- /dev/null +++ b/frontend/src/openapi/models/playgroundStrategySchemaLinks.ts @@ -0,0 +1,12 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * A set of links to actions you can perform on this strategy + */ +export type PlaygroundStrategySchemaLinks = { + edit: string; +}; diff --git a/frontend/src/openapi/models/variantSchema.ts b/frontend/src/openapi/models/variantSchema.ts index 61c0a3abea..bde412d5a5 100644 --- a/frontend/src/openapi/models/variantSchema.ts +++ b/frontend/src/openapi/models/variantSchema.ts @@ -6,11 +6,20 @@ import type { VariantSchemaPayload } from './variantSchemaPayload'; import type { OverrideSchema } from './overrideSchema'; +/** + * A variant allows for further separation of users into segments. See [our excellent documentation](https://docs.getunleash.io/reference/feature-toggle-variants#what-are-variants) for a more detailed description + */ export interface VariantSchema { + /** The variants name. Is unique for this feature toggle */ name: string; + /** The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/reference/feature-toggle-variants#variant-weight) for more information */ weight: number; + /** Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000 */ weightType?: string; + /** [Stickiness](https://docs.getunleash.io/reference/feature-toggle-variants#variant-stickiness) is how Unleash guarantees that the same user gets the same variant every time */ stickiness?: string; + /** Extra data configured for this variant */ payload?: VariantSchemaPayload; + /** Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence. */ overrides?: OverrideSchema[]; } diff --git a/frontend/src/openapi/models/variantSchemaPayload.ts b/frontend/src/openapi/models/variantSchemaPayload.ts index 6b48d8444f..6a636ff534 100644 --- a/frontend/src/openapi/models/variantSchemaPayload.ts +++ b/frontend/src/openapi/models/variantSchemaPayload.ts @@ -4,6 +4,9 @@ * See `gen:api` script in package.json */ +/** + * Extra data configured for this variant + */ export type VariantSchemaPayload = { type: string; value: string;