@featurevisor/core
Version:
Core package of Featurevisor for Node.js usage
107 lines (106 loc) • 3.38 kB
JSON
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$defs": {
"multiple_conditions": {
"type": "array",
"items": {
"anyOf": [{ "$ref": "#/$defs/plain_condition" }, { "$ref": "#/$defs/complex_condition" }]
}
},
"plain_condition": {
"type": "object",
"properties": {
"attribute": {
"type": "string",
"description": "Name of the attribute to be used in the condition."
},
"operator": {
"type": "string",
"description": "Operator to be used in the condition. Allowed values are: equals, notEquals, greaterThan, greaterThanOrEquals, lessThan, lessThanOrEquals, contains, notContains, startsWith, endsWith, semverEquals, semverNotEquals, semverGreaterThan, semverGreaterThanOrEquals, semverLessThan, semverLessThanOrEquals, in, notIn."
},
"value": {
"type": ["string", "number", "boolean", "array", "null"],
"description": "Value to be used in the condition. Can be a string, number, boolean, or array of strings."
}
},
"required": ["attribute", "operator", "value"]
},
"complex_condition": {
"type": "object",
"oneOf": [
{ "$ref": "#/$defs/and_condition" },
{ "$ref": "#/$defs/or_condition" },
{ "$ref": "#/$defs/not_condition" }
]
},
"and_condition": {
"type": "object",
"properties": {
"and": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "#/$defs/plain_condition" },
{ "$ref": "#/$defs/complex_condition" }
]
},
"description": "The list of conditions to be combined with the 'and' operator."
}
},
"required": ["and"]
},
"or_condition": {
"type": "object",
"properties": {
"or": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "#/$defs/plain_condition" },
{ "$ref": "#/$defs/complex_condition" }
]
},
"description": "The list of conditions to be combined with the 'or' operator."
}
},
"required": ["or"]
},
"not_condition": {
"type": "object",
"properties": {
"or": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "#/$defs/plain_condition" },
{ "$ref": "#/$defs/complex_condition" }
]
},
"description": "The list of conditions to be combined with the 'not' operator."
}
},
"required": ["not"]
}
},
"type": "object",
"properties": {
"archived": {
"type": "boolean",
"description": "Indicates whether the segment is archived or not."
},
"description": {
"type": "string",
"description": "Human readable description of the segment for documentation purposes."
},
"conditions": {
"oneOf": [
{ "$ref": "#/$defs/multiple_conditions" },
{ "$ref": "#/$defs/complex_condition" },
{ "$ref": "#/$defs/plain_condition" }
],
"description": "The set of conditions to be evaluated for the segment."
}
},
"description": "JSON Schema for creating Featurevisor segment, expressed in YAML",
"required": ["description", "conditions"]
}