Skip to content

Commit ef7253e

Browse files
committed
Shuffle around somethings in schema.json and rename defs
1 parent 13d24c7 commit ef7253e

9 files changed

+45
-40
lines changed

schemas/All.schema.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://www.flippercloud.io/expressions/All.schema.json",
44
"title": "All",
5-
"oneOf": [
6-
{ "$ref": "schema.json#/$defs/expression" },
7-
{ "type": "array", "items": { "$ref": "schema.json#/$defs/expression" } }
8-
]
5+
"$ref": "schema.json#/$defs/arguments(n)"
96
}

schemas/Any.schema.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://www.flippercloud.io/expressions/Any.schema.json",
44
"title": "Any",
5-
"oneOf": [
6-
{ "$ref": "schema.json#/$defs/expression" },
7-
{ "type": "array", "items": { "$ref": "schema.json#/$defs/expression" } }
8-
]
5+
"$ref": "schema.json#/$defs/arguments(n)"
96
}

schemas/Equal.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/Equal.schema.json",
44
"title": "Equal",
55
"description": "Compare two values for equality",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/GreaterThan.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/GreaterThan.schema.json",
44
"title": "GreaterThan",
55
"description": "Compare if the first argument is > the second argument.",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/GreaterThanOrEqualTo.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/GreaterThanOrEqualTo.schema.json",
44
"title": "GreaterThanOrEqualTo",
55
"description": "Compare if the first argument is >= the second argument.",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/LessThan.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/LessThan.schema.json",
44
"title": "LessThan",
55
"description": "Compare if the first argument is < the second argument.",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/LessThanOrEqualTo.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/LessThanOrEqualTo.schema.json",
44
"title": "LessThanOrEqualTo",
55
"description": "Compare if the first argument is < the second argument.",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/NotEqual.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"$id": "https://www.flippercloud.io/expressions/NotEqual.schema.json",
44
"title": "NotEqual",
55
"description": "Compare two values for equality",
6-
"$ref": "schema.json#/$defs/comparison"
6+
"$ref": "schema.json#/$defs/arguments(<=>)"
77
}

schemas/schema.json

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,16 @@
66
"$ref": "#/$defs/expression",
77
"$defs": {
88
"expression": {
9+
"description": "An expression can be a function or a constant (string, boolean, or number)",
910
"oneOf": [
1011
{ "$ref": "#/$defs/function" },
1112
{ "type": "string" },
1213
{ "type": "boolean" },
1314
{ "type": "number" }
1415
]
1516
},
16-
"string": {
17-
"oneOf": [
18-
{ "$ref": "#/$defs/function" },
19-
{ "type": "string" }
20-
]
21-
},
22-
"number": {
23-
"oneOf": [
24-
{ "$ref": "#/$defs/function" },
25-
{ "type": "number" }
26-
]
27-
},
28-
"argument": {
29-
"$comment": "Allow a single expression or an array with a single expression",
30-
"oneOf": [
31-
{ "$ref": "#/$defs/expression" },
32-
{ "type": "array", "items": { "$ref": "#/$defs/expression" }, "maxItems": 1 }
33-
]
34-
},
35-
"comparison": {
36-
"$comment": "An array with exactly two expressions",
37-
"type": "array",
38-
"items": { "$ref": "#/$defs/expression" },
39-
"maxItems": 2,
40-
"minItems": 2
41-
},
4217
"function": {
18+
"description": "A function is an object with a single property that is the name of the function and the value is the arguments to the function",
4319
"type": "object",
4420
"maxProperties": 1,
4521
"minProperties": 1,
@@ -64,6 +40,41 @@
6440
"Time": { "$ref": "Time.schema.json" }
6541
},
6642
"additionalProperties": false
43+
},
44+
"string": {
45+
"description": "A constant string value or a function that returns a string",
46+
"oneOf": [
47+
{ "$ref": "#/$defs/function" },
48+
{ "type": "string" }
49+
]
50+
},
51+
"number": {
52+
"description": "A constant numeric value or a function that returns a number",
53+
"oneOf": [
54+
{ "$ref": "#/$defs/function" },
55+
{ "type": "number" }
56+
]
57+
},
58+
"arguments(n)": {
59+
"description": "A single expression or an array of expressions",
60+
"oneOf": [
61+
{ "$ref": "#/$defs/expression" },
62+
{ "type": "array", "items": { "$ref": "#/$defs/expression" } }
63+
]
64+
},
65+
"argument": {
66+
"description": "A single expression or an array with at most one expression",
67+
"oneOf": [
68+
{ "$ref": "#/$defs/expression" },
69+
{ "type": "array", "items": { "$ref": "#/$defs/expression" }, "maxItems": 1 }
70+
]
71+
},
72+
"arguments(<=>)": {
73+
"description": "An array with exactly two expressions",
74+
"type": "array",
75+
"items": { "$ref": "#/$defs/expression" },
76+
"maxItems": 2,
77+
"minItems": 2
6778
}
6879
}
6980
}

0 commit comments

Comments
 (0)