Skip to content

Commit

Permalink
chore: rename toggle to flag #6 (#7122)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus authored May 23, 2024
1 parent 4824a02 commit 7937301
Show file tree
Hide file tree
Showing 52 changed files with 140 additions and 145 deletions.
10 changes: 5 additions & 5 deletions src/lib/middleware/rbac-middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ test('should lookup projectId from params', async () => {
);
});

test('should lookup projectId from feature toggle', async () => {
test('should lookup projectId from feature flag', async () => {
const projectId = 'some-project-33';
const featureName = 'some-feature-toggle';
const featureName = 'some-feature-flag';

const accessService = {
hasPermission: jest.fn(),
Expand Down Expand Up @@ -320,7 +320,7 @@ test('should lookup projectId from feature toggle', async () => {

test('should lookup projectId from data', async () => {
const projectId = 'some-project-33';
const featureName = 'some-feature-toggle';
const featureName = 'some-feature-flag';

const accessService = {
hasPermission: jest.fn(),
Expand Down Expand Up @@ -357,9 +357,9 @@ test('should lookup projectId from data', async () => {
);
});

test('Does not double check permission if not changing project when updating toggle', async () => {
test('Does not double check permission if not changing project when updating flag', async () => {
const oldProjectId = 'some-project-34';
const featureName = 'some-feature-toggle';
const featureName = 'some-feature-flag';
const accessService = {
hasPermission: jest.fn().mockReturnValue(true),
};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/admin-features-query-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const adminFeaturesQuerySchema = {
namePrefix: {
type: 'string',
description:
'A case-insensitive prefix filter for the names of feature toggles',
'A case-insensitive prefix filter for the names of feature flags',
example: 'demo.part1',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { sdkFlatContextSchema } from './sdk-flat-context-schema';
export const advancedPlaygroundEnvironmentFeatureSchema = {
$id: '#/components/schemas/advancedPlaygroundEnvironmentFeatureSchema',
description:
'A simplified feature toggle model intended for the Unleash playground.',
'A simplified feature flag model intended for the Unleash playground.',
type: 'object',
additionalProperties: false,
required: [
Expand All @@ -40,7 +40,7 @@ export const advancedPlaygroundEnvironmentFeatureSchema = {
description: "The feature's environment.",
},
context: {
description: 'The context to use when evaluating toggles',
description: 'The context to use when evaluating flags',
$ref: sdkFlatContextSchema.$id,
},
projectId: {
Expand Down Expand Up @@ -102,7 +102,7 @@ export const advancedPlaygroundEnvironmentFeatureSchema = {
name: {
type: 'string',
description:
"The variant's name. If there is no variant or if the toggle is disabled, this will be `disabled`",
"The variant's name. If there is no variant or if the flag is disabled, this will be `disabled`",
example: 'red-variant',
},
enabled: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/advanced-playground-feature-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { sdkFlatContextSchema } from './sdk-flat-context-schema';
export const advancedPlaygroundFeatureSchema = {
$id: '#/components/schemas/advancedPlaygroundFeatureSchema',
description:
'A simplified feature toggle model intended for the Unleash playground.',
'A simplified feature flag model intended for the Unleash playground.',
type: 'object',
additionalProperties: false,
required: ['name', 'projectId', 'environments'],
Expand Down
4 changes: 2 additions & 2 deletions src/lib/openapi/spec/batch-features-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import type { FromSchema } from 'json-schema-to-ts';
export const batchFeaturesSchema = {
$id: '#/components/schemas/batchFeaturesSchema',
type: 'object',
description: 'A list of feature toggle names for batch operations',
description: 'A list of feature flag names for batch operations',
required: ['features'],
properties: {
features: {
type: 'array',
items: {
type: 'string',
},
description: 'List of feature toggle names',
description: 'List of feature flag names',
example: ['my-feature-4', 'my-feature-5', 'my-feature-6'],
},
},
Expand Down
20 changes: 10 additions & 10 deletions src/lib/openapi/spec/client-feature-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ export const clientFeatureSchema = {
type: 'object',
required: ['name', 'enabled'],
description:
'Feature toggle configuration used by SDKs to evaluate state of a toggle',
'Feature flag configuration used by SDKs to evaluate state of a flag',
additionalProperties: false,
properties: {
name: {
type: 'string',
description:
'The unique name of a feature toggle. Is validated to be URL safe on creation',
'The unique name of a feature flag. Is validated to be URL safe on creation',
example: 'new.payment.flow.stripe',
},
type: {
type: 'string',
description:
'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',
'What kind of feature flag is this. Refer to the documentation on [feature flag types](https://docs.getunleash.io/reference/feature-toggle-types) for more information',
example: 'release',
},
description: {
type: 'string',
description: 'A description of the toggle',
description: 'A description of the flag',
nullable: true,
example: 'No variants here',
},
Expand All @@ -41,42 +41,42 @@ export const clientFeatureSchema = {
},
stale: {
description:
'If this is true Unleash believes this feature toggle has been active longer than Unleash expects a toggle of this type to be active',
'If this is true Unleash believes this feature flag has been active longer than Unleash expects a flag of this type to be active',
type: 'boolean',
example: false,
},
impressionData: {
description:
'Set to true if SDKs should trigger [impression events](https://docs.getunleash.io/reference/impression-data) when this toggle is evaluated',
'Set to true if SDKs should trigger [impression events](https://docs.getunleash.io/reference/impression-data) when this flag is evaluated',
type: 'boolean',
nullable: true,
example: false,
},
project: {
description: 'Which project this feature toggle belongs to',
description: 'Which project this feature flag belongs to',
type: 'string',
example: 'new.payment.flow',
},
strategies: {
type: 'array',
description:
'Evaluation strategies for this toggle. Each entry in this list will be evaluated and ORed together',
'Evaluation strategies for this flag. Each entry in this list will be evaluated and ORed together',
items: {
$ref: '#/components/schemas/featureStrategySchema',
},
},
variants: {
type: 'array',
description:
'[Variants](https://docs.getunleash.io/reference/feature-toggle-variants#what-are-variants) configured for this toggle',
'[Variants](https://docs.getunleash.io/reference/feature-toggle-variants#what-are-variants) configured for this flag',
items: {
$ref: '#/components/schemas/variantSchema',
},
nullable: true,
},
dependencies: {
type: 'array',
description: 'Feature dependencies for this toggle',
description: 'Feature dependencies for this flag',
items: {
$ref: '#/components/schemas/dependentFeatureSchema',
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/client-features-query-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const clientFeaturesQuerySchema = {
environment: {
type: 'string',
description:
'Strategies for the feature toggle configured for this environment are included. (DEPRECATED) - Handled by API tokens',
'Strategies for the feature flag configured for this environment are included. (DEPRECATED) - Handled by API tokens',
deprecated: true,
},
inlineSegmentConstraints: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/client-features-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const clientFeaturesSchema = {
minimum: 0,
},
features: {
description: 'A list of feature toggles with their configuration',
description: 'A list of feature flags with their configuration',
type: 'array',
items: {
$ref: '#/components/schemas/clientFeatureSchema',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/openapi/spec/create-feature-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { FromSchema } from 'json-schema-to-ts';
export const createFeatureSchema = {
$id: '#/components/schemas/createFeatureSchema',
type: 'object',
description: 'Data used to create a new feature toggle.',
description: 'Data used to create a new feature flag.',
required: ['name'],
properties: {
name: {
Expand All @@ -15,7 +15,7 @@ export const createFeatureSchema = {
type: 'string',
example: 'release',
description:
"The feature toggle's [type](https://docs.getunleash.io/reference/feature-toggle-types). One of experiment, kill-switch, release, operational, or permission",
"The feature flag's [type](https://docs.getunleash.io/reference/feature-toggle-types). One of experiment, kill-switch, release, operational, or permission",
},
description: {
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/create-strategy-variant-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const createStrategyVariantSchema = {
name: {
type: 'string',
description:
'The variant name. Must be unique for this feature toggle',
'The variant name. Must be unique for this feature flag',
example: 'blue_group',
},
weight: {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/openapi/spec/dora-features-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const doraFeaturesSchema = {
properties: {
name: {
type: 'string',
description: 'The name of a feature toggle',
description: 'The name of a feature flag',
},
timeToProduction: {
type: 'number',
description:
'The average number of days it takes a feature toggle to get into production',
'The average number of days it takes a feature flag to get into production',
},
},
components: {},
Expand Down
8 changes: 4 additions & 4 deletions src/lib/openapi/spec/event-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const eventDataSchema = {
nullable: true,
'x-enforcer-exception-skip-codes': 'WSCH006', // allow additional properties in example (openapi enforcer)
description:
'Extra associated data related to the event, such as feature toggle state, segment configuration, etc., if applicable.',
'Extra associated data related to the event, such as feature flag state, segment configuration, etc., if applicable.',
example: {
name: 'new-feature',
description: 'Toggle description',
description: 'Flag description',
type: 'release',
project: 'my-project',
stale: false,
Expand Down Expand Up @@ -61,7 +61,7 @@ export const eventSchema = {
environment: {
type: 'string',
description:
'The feature toggle environment the event relates to, if applicable.',
'The feature flag environment the event relates to, if applicable.',
nullable: true,
example: 'development',
},
Expand All @@ -75,7 +75,7 @@ export const eventSchema = {
type: 'string',
nullable: true,
description:
'The name of the feature toggle the event relates to, if applicable.',
'The name of the feature flag the event relates to, if applicable.',
example: 'my.first.feature',
},
data: eventDataSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/export-query-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const exportQueryParameters = [
default: true,
},
description:
'Whether feature toggles should be included in the exported data.',
'Whether feature flags should be included in the exported data.',
in: 'query',
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/openapi/spec/export-result-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const exportResultSchema = {
type: 'object',
additionalProperties: false,
description:
'The result of the export operation, providing you with the feature toggle definitions, strategy definitions and the rest of the elements relevant to the features (tags, environments etc.)',
'The result of the export operation, providing you with the feature flag definitions, strategy definitions and the rest of the elements relevant to the features (tags, environments etc.)',
required: ['features', 'featureStrategies', 'tagTypes'],
properties: {
features: {
Expand Down
9 changes: 4 additions & 5 deletions src/lib/openapi/spec/feature-events-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const featureEventsSchema = {
type: 'object',
additionalProperties: false,
required: ['events'],
description: 'One or more events happening to a specific feature toggle',
description: 'One or more events happening to a specific feature flag',
properties: {
version: {
type: 'integer',
Expand All @@ -17,18 +17,17 @@ export const featureEventsSchema = {
example: 1,
},
toggleName: {
description:
'The name of the feature toggle these events relate to',
description: 'The name of the feature flag these events relate to',
type: 'string',
example: 'my.first.feature.toggle',
example: 'my.first.feature.flag',
},
events: {
description: 'The list of events',
type: 'array',
items: { $ref: eventSchema.$id },
},
totalEvents: {
description: 'How many events are there for this feature toggle',
description: 'How many events are there for this feature flag',
type: 'integer',
minimum: 0,
example: 13,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/openapi/spec/feature-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const featureSchema = {
type: 'object',
additionalProperties: false,
required: ['name'],
description: 'A feature toggle definition',
description: 'A feature flag definition',
properties: {
name: {
type: 'string',
Expand All @@ -24,7 +24,7 @@ export const featureSchema = {
type: 'string',
example: 'kill-switch',
description:
'Type of the toggle e.g. experiment, kill-switch, release, operational, permission',
'Type of the flag e.g. experiment, kill-switch, release, operational, permission',
},
description: {
type: 'string',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/openapi/spec/feature-search-response-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const featureSearchResponseSchema = {
'environments',
'segments',
],
description: 'A feature toggle definition',
description: 'A feature flag definition',
properties: {
name: {
type: 'string',
Expand All @@ -35,7 +35,7 @@ export const featureSearchResponseSchema = {
type: 'string',
example: 'kill-switch',
description:
'Type of the toggle e.g. experiment, kill-switch, release, operational, permission',
'Type of the flag e.g. experiment, kill-switch, release, operational, permission',
},
description: {
type: 'string',
Expand Down
12 changes: 6 additions & 6 deletions src/lib/openapi/spec/feature-type-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ export const featureTypeSchema = {
$id: '#/components/schemas/featureTypeSchema',
type: 'object',
description:
'A [feature toggle type](https://docs.getunleash.io/reference/feature-toggle-types).',
'A [feature flag type](https://docs.getunleash.io/reference/feature-toggle-types).',
additionalProperties: false,
required: ['id', 'name', 'description', 'lifetimeDays'],
properties: {
id: {
type: 'string',
description: 'The identifier of this feature toggle type.',
description: 'The identifier of this feature flag type.',
example: 'kill-switch',
},
name: {
type: 'string',
description: 'The display name of this feature toggle type.',
description: 'The display name of this feature flag type.',
example: 'Kill switch',
},
description: {
type: 'string',
description:
'A description of what this feature toggle type is intended to be used for.',
'A description of what this feature flag type is intended to be used for.',
example:
'Kill switch feature toggles are used to quickly turn on or off critical functionality in your system.',
'Kill switch feature flags are used to quickly turn on or off critical functionality in your system.',
},
lifetimeDays: {
type: 'integer',
minimum: 0,
description:
'How many days it takes before a feature toggle of this typed is flagged as [potentially stale](https://docs.getunleash.io/reference/technical-debt#stale-and-potentially-stale-toggles) by Unleash. If this value is `null`, Unleash will never mark it as potentially stale.',
'How many days it takes before a feature flag of this typed is flagged as [potentially stale](https://docs.getunleash.io/reference/technical-debt#stale-and-potentially-stale-toggles) by Unleash. If this value is `null`, Unleash will never mark it as potentially stale.',
example: 40,
nullable: true,
},
Expand Down
Loading

0 comments on commit 7937301

Please sign in to comment.