Skip to content

Commit 3d38bc5

Browse files
committed
Added message schemas
1 parent 69eabcf commit 3d38bc5

6 files changed

Lines changed: 124 additions & 0 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/plan-response-data-schema.json",
4+
"title": "Plan Response Schema Data",
5+
"description": "Apply the previously generated plan. The plan must already be generated in order for apply to work.",
6+
"type": "object",
7+
"properties": {
8+
"planId": {
9+
"description": "The plan uuid. This id is used to look up the generated plan on the plugin side",
10+
"type": "string",
11+
"format": "uuid"
12+
}
13+
},
14+
"required": ["planId"],
15+
"additionalProperties": false
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/error-response-data-schema.json",
4+
"title": "Error Response Schema Data",
5+
"type": "object",
6+
"properties": {
7+
"reason": {
8+
"description": "A human read-able reason for the error",
9+
"type": "string"
10+
}
11+
},
12+
"required": ["reason"],
13+
"additionalProperties": false
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/plan-request-data-schema.json",
4+
"title": "Plan Request Schema Data",
5+
"$ref": "../resource-schema.json"
6+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/plan-response-data-schema.json",
4+
"title": "Plan Response Schema Data",
5+
"type": "object",
6+
"properties": {
7+
"planId": {
8+
"description": "The id of the plan to look up for the apply operation",
9+
"type": "string",
10+
"format": "uuid"
11+
},
12+
"operation": {
13+
"description": "The plan operation",
14+
"type": "string",
15+
"enum" : ["create", "destroy", "modify", "recreate", "noop"]
16+
},
17+
"resourceType": {
18+
"description": "The resource type",
19+
"type": "string"
20+
},
21+
"resourceName": {
22+
"description": "The resource name",
23+
"type": ["string", "null"]
24+
},
25+
"parameters": {
26+
"description": "The properties come from the provided config and is not necessarily every parameter on the ",
27+
"type": "array",
28+
"items": {
29+
"type": "object",
30+
"properties": {
31+
"name": {
32+
"description": "The property name",
33+
"type": "string"
34+
},
35+
"operation": {
36+
"description": "The operation to be performed on the parameter",
37+
"type": "string",
38+
"enum": ["remove", "add", "modify", "noop"]
39+
},
40+
"previousValue": {
41+
"description": "The value before the change"
42+
},
43+
"newValue": {
44+
"description": "The new value"
45+
}
46+
},
47+
"required": ["name", "operation", "previousValue", "newValue"]
48+
}
49+
}
50+
},
51+
"required": ["planId", "operation", "resourceType", "resourceName", "parameters"],
52+
"additionalProperties": false
53+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/validate-request-data-schema.json",
4+
"title": "Validate Request Schema Data",
5+
"type": "array",
6+
"items": {
7+
"$ref": "../resource-schema.json"
8+
}
9+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://www.codify.com/validate-response-data-schema.json",
4+
"title": "Validate Response Schema Data",
5+
"type": "object",
6+
"properties": {
7+
"type": {
8+
"description": "The resource type",
9+
"type": "string",
10+
"pattern": "^[a-zA-Z-_][\\w-]+$"
11+
},
12+
"name": {
13+
"description": "Optional name. Useful for specifying multiple resources of the same type",
14+
"type": "string",
15+
"pattern": "^[a-zA-Z-_][\\w-]+$"
16+
},
17+
"dependsOn": {
18+
"type": "array",
19+
"items": {
20+
"type": "string"
21+
},
22+
"uniqueItems": true
23+
}
24+
},
25+
"required": ["type"]
26+
}

0 commit comments

Comments
 (0)