-
-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: split features schema into archived and project features (#7973)
- Loading branch information
Showing
10 changed files
with
354 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import type { FromSchema } from 'json-schema-to-ts'; | ||
|
||
export const archivedFeatureSchema = { | ||
$id: '#/components/schemas/archivedFeatureSchema', | ||
type: 'object', | ||
additionalProperties: false, | ||
required: ['name', 'project'], | ||
description: 'An archived project feature flag definition', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
example: 'disable-comments', | ||
description: 'Unique feature name', | ||
}, | ||
type: { | ||
type: 'string', | ||
example: 'kill-switch', | ||
description: | ||
'Type of the flag e.g. experiment, kill-switch, release, operational, permission', | ||
}, | ||
description: { | ||
type: 'string', | ||
nullable: true, | ||
example: | ||
'Controls disabling of the comments section in case of an incident', | ||
description: 'Detailed description of the feature', | ||
}, | ||
project: { | ||
type: 'string', | ||
example: 'dx-squad', | ||
description: 'Name of the project the feature belongs to', | ||
}, | ||
stale: { | ||
type: 'boolean', | ||
example: false, | ||
description: | ||
'`true` if the feature is stale based on the age and feature type, otherwise `false`.', | ||
}, | ||
impressionData: { | ||
type: 'boolean', | ||
example: false, | ||
description: | ||
'`true` if the impression data collection is enabled for the feature, otherwise `false`.', | ||
}, | ||
createdAt: { | ||
type: 'string', | ||
format: 'date-time', | ||
example: '2023-01-28T15:21:39.975Z', | ||
description: 'The date the feature was created', | ||
}, | ||
archivedAt: { | ||
type: 'string', | ||
format: 'date-time', | ||
example: '2023-01-29T15:21:39.975Z', | ||
description: 'The date the feature was archived', | ||
}, | ||
lastSeenAt: { | ||
type: 'string', | ||
format: 'date-time', | ||
nullable: true, | ||
deprecated: true, | ||
example: '2023-01-28T16:21:39.975Z', | ||
description: | ||
'The date when metrics where last collected for the feature. This field was deprecated in v5, use the one in featureEnvironmentSchema', | ||
}, | ||
environments: { | ||
type: 'array', | ||
deprecated: true, | ||
description: | ||
'The list of environments where the feature can be used', | ||
items: { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
example: 'my-dev-env', | ||
description: 'The name of the environment', | ||
}, | ||
lastSeenAt: { | ||
type: 'string', | ||
format: 'date-time', | ||
nullable: true, | ||
example: '2023-01-28T16:21:39.975Z', | ||
description: | ||
'The date when metrics where last collected for the feature environment', | ||
}, | ||
enabled: { | ||
type: 'boolean', | ||
example: true, | ||
description: | ||
'`true` if the feature is enabled for the environment, otherwise `false`.', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
components: { | ||
schemas: {}, | ||
}, | ||
} as const; | ||
|
||
export type ArchivedFeatureSchema = FromSchema<typeof archivedFeatureSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { FromSchema } from 'json-schema-to-ts'; | ||
import { archivedFeatureSchema } from './archived-feature-schema'; | ||
|
||
export const archivedFeaturesSchema = { | ||
$id: '#/components/schemas/archivedFeaturesSchema', | ||
type: 'object', | ||
additionalProperties: false, | ||
required: ['version', 'features'], | ||
description: 'A list of archived features', | ||
deprecated: true, | ||
properties: { | ||
version: { | ||
type: 'integer', | ||
description: "The version of the feature's schema", | ||
}, | ||
features: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/archivedFeatureSchema', | ||
}, | ||
description: 'A list of features', | ||
}, | ||
}, | ||
components: { | ||
schemas: { | ||
archivedFeatureSchema, | ||
}, | ||
}, | ||
} as const; | ||
|
||
export type ArchivedFeaturesSchema = FromSchema<typeof archivedFeaturesSchema>; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.