mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
chore: amend open api tags descriptions and examples (#3519)
## About the changes Adds descriptions and examples to tag schemas
This commit is contained in:
parent
74986d672e
commit
d4c24c9520
@ -92,7 +92,6 @@ const metaRules: Rule[] = [
|
|||||||
'featuresSchema',
|
'featuresSchema',
|
||||||
'featureStrategySchema',
|
'featureStrategySchema',
|
||||||
'featureStrategySegmentSchema',
|
'featureStrategySegmentSchema',
|
||||||
'featureTagSchema',
|
|
||||||
'featureTypeSchema',
|
'featureTypeSchema',
|
||||||
'featureTypesSchema',
|
'featureTypesSchema',
|
||||||
'featureUsageSchema',
|
'featureUsageSchema',
|
||||||
@ -144,9 +143,6 @@ const metaRules: Rule[] = [
|
|||||||
'stateSchema',
|
'stateSchema',
|
||||||
'strategiesSchema',
|
'strategiesSchema',
|
||||||
'strategySchema',
|
'strategySchema',
|
||||||
'tagsBulkAddSchema',
|
|
||||||
'tagSchema',
|
|
||||||
'tagsSchema',
|
|
||||||
'tagTypeSchema',
|
'tagTypeSchema',
|
||||||
'tagTypesSchema',
|
'tagTypesSchema',
|
||||||
'tagWithVersionSchema',
|
'tagWithVersionSchema',
|
||||||
@ -157,7 +153,6 @@ const metaRules: Rule[] = [
|
|||||||
'updateFeatureStrategySchema',
|
'updateFeatureStrategySchema',
|
||||||
'updateTagTypeSchema',
|
'updateTagTypeSchema',
|
||||||
'updateUserSchema',
|
'updateUserSchema',
|
||||||
'updateTagsSchema',
|
|
||||||
'upsertContextFieldSchema',
|
'upsertContextFieldSchema',
|
||||||
'upsertSegmentSchema',
|
'upsertSegmentSchema',
|
||||||
'upsertStrategySchema',
|
'upsertStrategySchema',
|
||||||
|
@ -3,23 +3,36 @@ import { FromSchema } from 'json-schema-to-ts';
|
|||||||
export const featureTagSchema = {
|
export const featureTagSchema = {
|
||||||
$id: '#/components/schemas/featureTagSchema',
|
$id: '#/components/schemas/featureTagSchema',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
description: 'Describes a tag applied to a feature',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['featureName', 'tagValue'],
|
required: ['featureName', 'tagValue'],
|
||||||
properties: {
|
properties: {
|
||||||
featureName: {
|
featureName: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
example: 'my-feature',
|
||||||
|
description: 'The name of the feature this tag is applied to',
|
||||||
},
|
},
|
||||||
tagType: {
|
tagType: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
example: 'simple',
|
||||||
|
description: 'The type of tag',
|
||||||
},
|
},
|
||||||
tagValue: {
|
tagValue: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
example: 'my-tag',
|
||||||
|
description: 'The value of the tag',
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
|
deprecated: true,
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'This field is deprecated and currently unused, use tagType instead',
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
|
deprecated: true,
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'This field is deprecated and currently unused, use tagValue instead',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
|
@ -5,6 +5,7 @@ export const TAG_MAX_LENGTH = 50;
|
|||||||
export const tagSchema = {
|
export const tagSchema = {
|
||||||
$id: '#/components/schemas/tagSchema',
|
$id: '#/components/schemas/tagSchema',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
description: 'Representation of a tag',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['value', 'type'],
|
required: ['value', 'type'],
|
||||||
properties: {
|
properties: {
|
||||||
@ -12,18 +13,18 @@ export const tagSchema = {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
minLength: TAG_MIN_LENGTH,
|
minLength: TAG_MIN_LENGTH,
|
||||||
maxLength: TAG_MAX_LENGTH,
|
maxLength: TAG_MAX_LENGTH,
|
||||||
|
description: 'The value of the tag',
|
||||||
|
example: 'a-tag-value',
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
minLength: TAG_MIN_LENGTH,
|
minLength: TAG_MIN_LENGTH,
|
||||||
maxLength: TAG_MAX_LENGTH,
|
maxLength: TAG_MAX_LENGTH,
|
||||||
default: 'simple',
|
default: 'simple',
|
||||||
|
description: 'The type of the tag',
|
||||||
|
example: 'simple',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
example: {
|
|
||||||
value: 'tag-value',
|
|
||||||
type: 'simple',
|
|
||||||
},
|
|
||||||
components: {},
|
components: {},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -4,11 +4,14 @@ import { tagSchema } from './tag-schema';
|
|||||||
|
|
||||||
export const tagsBulkAddSchema = {
|
export const tagsBulkAddSchema = {
|
||||||
$id: '#/components/schemas/tagsBulkAddSchema',
|
$id: '#/components/schemas/tagsBulkAddSchema',
|
||||||
|
description: 'Represents tag changes to be applied to a list of features.',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['features', 'tags'],
|
required: ['features', 'tags'],
|
||||||
properties: {
|
properties: {
|
||||||
features: {
|
features: {
|
||||||
|
description:
|
||||||
|
'The list of features that will be affected by the tag changes.',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
@ -16,6 +19,7 @@ export const tagsBulkAddSchema = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
tags: {
|
tags: {
|
||||||
|
description: 'The tag changes to be applied to the features.',
|
||||||
$ref: '#/components/schemas/updateTagsSchema',
|
$ref: '#/components/schemas/updateTagsSchema',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,15 +3,18 @@ import { tagSchema } from './tag-schema';
|
|||||||
|
|
||||||
export const tagsSchema = {
|
export const tagsSchema = {
|
||||||
$id: '#/components/schemas/tagsSchema',
|
$id: '#/components/schemas/tagsSchema',
|
||||||
|
description: 'A list of tags with a version number',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['version', 'tags'],
|
required: ['version', 'tags'],
|
||||||
properties: {
|
properties: {
|
||||||
version: {
|
version: {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
|
description: 'The version of the schema used to model the tags.',
|
||||||
},
|
},
|
||||||
tags: {
|
tags: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
description: 'A list of tags.',
|
||||||
items: {
|
items: {
|
||||||
$ref: '#/components/schemas/tagSchema',
|
$ref: '#/components/schemas/tagSchema',
|
||||||
},
|
},
|
||||||
|
@ -4,17 +4,20 @@ import { tagSchema } from './tag-schema';
|
|||||||
export const updateTagsSchema = {
|
export const updateTagsSchema = {
|
||||||
$id: '#/components/schemas/updateTagsSchema',
|
$id: '#/components/schemas/updateTagsSchema',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
description: 'Represents a set of changes to tags of a feature.',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: ['addedTags', 'removedTags'],
|
required: ['addedTags', 'removedTags'],
|
||||||
properties: {
|
properties: {
|
||||||
addedTags: {
|
addedTags: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
description: 'Tags to add to the feature.',
|
||||||
items: {
|
items: {
|
||||||
$ref: '#/components/schemas/tagSchema',
|
$ref: '#/components/schemas/tagSchema',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
removedTags: {
|
removedTags: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
description: 'Tags to remove from the feature.',
|
||||||
items: {
|
items: {
|
||||||
$ref: '#/components/schemas/tagSchema',
|
$ref: '#/components/schemas/tagSchema',
|
||||||
},
|
},
|
||||||
|
@ -1618,20 +1618,31 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
},
|
},
|
||||||
"featureTagSchema": {
|
"featureTagSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
"description": "Describes a tag applied to a feature",
|
||||||
"properties": {
|
"properties": {
|
||||||
"featureName": {
|
"featureName": {
|
||||||
|
"description": "The name of the feature this tag is applied to",
|
||||||
|
"example": "my-feature",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"tagType": {
|
"tagType": {
|
||||||
|
"description": "The type of tag",
|
||||||
|
"example": "simple",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"tagValue": {
|
"tagValue": {
|
||||||
|
"description": "The value of the tag",
|
||||||
|
"example": "my-tag",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
|
"deprecated": true,
|
||||||
|
"description": "This field is deprecated and currently unused, use tagType instead",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
"deprecated": true,
|
||||||
|
"description": "This field is deprecated and currently unused, use tagValue instead",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -3706,18 +3717,19 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"tagSchema": {
|
"tagSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"example": {
|
"description": "Representation of a tag",
|
||||||
"type": "simple",
|
|
||||||
"value": "tag-value",
|
|
||||||
},
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"default": "simple",
|
"default": "simple",
|
||||||
|
"description": "The type of the tag",
|
||||||
|
"example": "simple",
|
||||||
"maxLength": 50,
|
"maxLength": 50,
|
||||||
"minLength": 2,
|
"minLength": 2,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
"description": "The value of the tag",
|
||||||
|
"example": "a-tag-value",
|
||||||
"maxLength": 50,
|
"maxLength": 50,
|
||||||
"minLength": 2,
|
"minLength": 2,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -3785,8 +3797,10 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"tagsBulkAddSchema": {
|
"tagsBulkAddSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
"description": "Represents tag changes to be applied to a list of features.",
|
||||||
"properties": {
|
"properties": {
|
||||||
"features": {
|
"features": {
|
||||||
|
"description": "The list of features that will be affected by the tag changes.",
|
||||||
"items": {
|
"items": {
|
||||||
"minLength": 1,
|
"minLength": 1,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -3795,6 +3809,7 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"$ref": "#/components/schemas/updateTagsSchema",
|
"$ref": "#/components/schemas/updateTagsSchema",
|
||||||
|
"description": "The tag changes to be applied to the features.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -3805,14 +3820,17 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"tagsSchema": {
|
"tagsSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
"description": "A list of tags with a version number",
|
||||||
"properties": {
|
"properties": {
|
||||||
"tags": {
|
"tags": {
|
||||||
|
"description": "A list of tags.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/tagSchema",
|
"$ref": "#/components/schemas/tagSchema",
|
||||||
},
|
},
|
||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
"version": {
|
"version": {
|
||||||
|
"description": "The version of the schema used to model the tags.",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -4028,6 +4046,7 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"updateTagsSchema": {
|
"updateTagsSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
"description": "Represents a set of changes to tags of a feature.",
|
||||||
"example": {
|
"example": {
|
||||||
"addedTags": [
|
"addedTags": [
|
||||||
{
|
{
|
||||||
@ -4044,12 +4063,14 @@ Stats are divided into current and previous **windows**.
|
|||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"addedTags": {
|
"addedTags": {
|
||||||
|
"description": "Tags to add to the feature.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/tagSchema",
|
"$ref": "#/components/schemas/tagSchema",
|
||||||
},
|
},
|
||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
"removedTags": {
|
"removedTags": {
|
||||||
|
"description": "Tags to remove from the feature.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/tagSchema",
|
"$ref": "#/components/schemas/tagSchema",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user