mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-13 11:17:26 +02:00
docs: open api examples for segment schemas (#3503)
## About the changes Add additional documentation for segments --------- Co-authored-by: Nuno Góis <github@nunogois.com>
This commit is contained in:
parent
3231c7d00e
commit
c1a1a0fdeb
@ -18,6 +18,7 @@ export const constraintSchemaBase = {
|
|||||||
'The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).',
|
'The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/reference/strategy-constraints#strategy-constraint-operators).',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: ALL_OPERATORS,
|
enum: ALL_OPERATORS,
|
||||||
|
example: 'IN',
|
||||||
},
|
},
|
||||||
caseInsensitive: {
|
caseInsensitive: {
|
||||||
description:
|
description:
|
||||||
@ -38,11 +39,13 @@ export const constraintSchemaBase = {
|
|||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
|
example: ['my-app', 'my-other-app'],
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
description:
|
description:
|
||||||
'The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.',
|
'The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
example: 'my-app',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
|
@ -19,6 +19,8 @@ export const segmentSchema = {
|
|||||||
},
|
},
|
||||||
constraints: {
|
constraints: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
description:
|
||||||
|
'List of constraints that determine which users are part of the segment',
|
||||||
items: {
|
items: {
|
||||||
$ref: '#/components/schemas/constraintSchema',
|
$ref: '#/components/schemas/constraintSchema',
|
||||||
},
|
},
|
||||||
|
@ -16,14 +16,30 @@ export const upsertSegmentSchema = {
|
|||||||
project: {
|
project: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
description:
|
||||||
|
'Project from where this segment will be accessible. If none is defined the segment will be global (i.e. accessible from any project).',
|
||||||
},
|
},
|
||||||
constraints: {
|
constraints: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
|
description:
|
||||||
|
'List of constraints that determine which users will be part of the segment',
|
||||||
items: {
|
items: {
|
||||||
$ref: '#/components/schemas/constraintSchema',
|
$ref: '#/components/schemas/constraintSchema',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
example: {
|
||||||
|
name: 'segment name',
|
||||||
|
description: 'segment description',
|
||||||
|
project: 'optional project id',
|
||||||
|
constraints: [
|
||||||
|
{
|
||||||
|
contextName: 'environment',
|
||||||
|
operator: 'IN',
|
||||||
|
values: ['production', 'staging'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
constraintSchema,
|
constraintSchema,
|
||||||
|
@ -761,14 +761,20 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"SEMVER_GT",
|
"SEMVER_GT",
|
||||||
"SEMVER_LT",
|
"SEMVER_LT",
|
||||||
],
|
],
|
||||||
|
"example": "IN",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"description": "The context value that should be used for constraint evaluation. Use this property instead of \`values\` for properties that only accept single values.",
|
"description": "The context value that should be used for constraint evaluation. Use this property instead of \`values\` for properties that only accept single values.",
|
||||||
|
"example": "my-app",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"values": {
|
"values": {
|
||||||
"description": "The context values that should be used for constraint evaluation. Use this property instead of \`value\` for properties that accept multiple values.",
|
"description": "The context values that should be used for constraint evaluation. Use this property instead of \`value\` for properties that accept multiple values.",
|
||||||
|
"example": [
|
||||||
|
"my-app",
|
||||||
|
"my-other-app",
|
||||||
|
],
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
@ -2397,6 +2403,7 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"SEMVER_GT",
|
"SEMVER_GT",
|
||||||
"SEMVER_LT",
|
"SEMVER_LT",
|
||||||
],
|
],
|
||||||
|
"example": "IN",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
@ -2405,10 +2412,15 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"description": "The context value that should be used for constraint evaluation. Use this property instead of \`values\` for properties that only accept single values.",
|
"description": "The context value that should be used for constraint evaluation. Use this property instead of \`values\` for properties that only accept single values.",
|
||||||
|
"example": "my-app",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"values": {
|
"values": {
|
||||||
"description": "The context values that should be used for constraint evaluation. Use this property instead of \`value\` for properties that accept multiple values.",
|
"description": "The context values that should be used for constraint evaluation. Use this property instead of \`value\` for properties that accept multiple values.",
|
||||||
|
"example": [
|
||||||
|
"my-app",
|
||||||
|
"my-other-app",
|
||||||
|
],
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
@ -3455,6 +3467,7 @@ Stats are divided into current and previous **windows**.
|
|||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"constraints": {
|
"constraints": {
|
||||||
|
"description": "List of constraints that determine which users are part of the segment",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/constraintSchema",
|
"$ref": "#/components/schemas/constraintSchema",
|
||||||
},
|
},
|
||||||
@ -4068,8 +4081,24 @@ Stats are divided into current and previous **windows**.
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
},
|
},
|
||||||
"upsertSegmentSchema": {
|
"upsertSegmentSchema": {
|
||||||
|
"example": {
|
||||||
|
"constraints": [
|
||||||
|
{
|
||||||
|
"contextName": "environment",
|
||||||
|
"operator": "IN",
|
||||||
|
"values": [
|
||||||
|
"production",
|
||||||
|
"staging",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"description": "segment description",
|
||||||
|
"name": "segment name",
|
||||||
|
"project": "optional project id",
|
||||||
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"constraints": {
|
"constraints": {
|
||||||
|
"description": "List of constraints that determine which users will be part of the segment",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/components/schemas/constraintSchema",
|
"$ref": "#/components/schemas/constraintSchema",
|
||||||
},
|
},
|
||||||
@ -4083,6 +4112,7 @@ Stats are divided into current and previous **windows**.
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
"project": {
|
"project": {
|
||||||
|
"description": "Project from where this segment will be accessible. If none is defined the segment will be global (i.e. accessible from any project).",
|
||||||
"nullable": true,
|
"nullable": true,
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user