Skip to content

Commit 906ce8c

Browse files
committed
Swagger/openapi schema mega fixes and Cypress validation/enforcement
1 parent 89abb9d commit 906ce8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2003
-539
lines changed

backend/schema/common.json

Lines changed: 139 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"description": "Unique identifier",
88
"readOnly": true,
99
"type": "integer",
10-
"minimum": 1
10+
"minimum": 1,
11+
"example": 11
1112
},
1213
"expand": {
1314
"anyOf": [
@@ -38,35 +39,42 @@
3839
"created_on": {
3940
"description": "Date and time of creation",
4041
"readOnly": true,
41-
"type": "string"
42+
"type": "string",
43+
"example": "2025-10-28T04:17:54.000Z"
4244
},
4345
"modified_on": {
4446
"description": "Date and time of last update",
4547
"readOnly": true,
46-
"type": "string"
48+
"type": "string",
49+
"example": "2025-10-28T04:17:54.000Z"
4750
},
4851
"user_id": {
4952
"description": "User ID",
5053
"type": "integer",
51-
"minimum": 1
54+
"minimum": 1,
55+
"example": 2
5256
},
5357
"certificate_id": {
5458
"description": "Certificate ID",
5559
"anyOf": [
5660
{
5761
"type": "integer",
58-
"minimum": 0
62+
"minimum": 0,
63+
"example": 5
5964
},
6065
{
6166
"type": "string",
62-
"pattern": "^new$"
67+
"pattern": "^new$",
68+
"example": "new"
6369
}
64-
]
70+
],
71+
"example": 5
6572
},
6673
"access_list_id": {
6774
"description": "Access List ID",
6875
"type": "integer",
69-
"minimum": 0
76+
"minimum": 0,
77+
"example": 3
7078
},
7179
"domain_names": {
7280
"description": "Domain Names separated by a comma",
@@ -77,44 +85,157 @@
7785
"items": {
7886
"type": "string",
7987
"pattern": "^[^&| @!#%^();:/\\\\}{=+?<>,~`'\"]+$"
80-
}
88+
},
89+
"example": ["example.com", "www.example.com"]
8190
},
8291
"enabled": {
8392
"description": "Is Enabled",
84-
"type": "boolean"
93+
"type": "boolean",
94+
"example": false
8595
},
8696
"ssl_forced": {
8797
"description": "Is SSL Forced",
88-
"type": "boolean"
98+
"type": "boolean",
99+
"example": true
89100
},
90101
"hsts_enabled": {
91102
"description": "Is HSTS Enabled",
92-
"type": "boolean"
103+
"type": "boolean",
104+
"example": true
93105
},
94106
"hsts_subdomains": {
95107
"description": "Is HSTS applicable to all subdomains",
96-
"type": "boolean"
108+
"type": "boolean",
109+
"example": true
97110
},
98111
"ssl_provider": {
99112
"type": "string",
100-
"pattern": "^(letsencrypt|other)$"
113+
"pattern": "^(letsencrypt|other)$",
114+
"example": "letsencrypt"
101115
},
102116
"http2_support": {
103117
"description": "HTTP2 Protocol Support",
104-
"type": "boolean"
118+
"type": "boolean",
119+
"example": true
105120
},
106121
"block_exploits": {
107122
"description": "Should we block common exploits",
108-
"type": "boolean"
123+
"type": "boolean",
124+
"example": false
109125
},
110126
"caching_enabled": {
111127
"description": "Should we cache assets",
112-
"type": "boolean"
128+
"type": "boolean",
129+
"example": true
113130
},
114131
"email": {
115132
"description": "Email address",
116133
"type": "string",
117-
"pattern": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$"
134+
"pattern": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$",
135+
"example": "me@example.com"
136+
},
137+
"directive": {
138+
"type": "string",
139+
"enum": ["allow", "deny"],
140+
"example": "allow"
141+
},
142+
"address": {
143+
"oneOf": [
144+
{
145+
"type": "string",
146+
"pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$"
147+
},
148+
{
149+
"type": "string",
150+
"pattern": "^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$"
151+
},
152+
{
153+
"type": "string",
154+
"pattern": "^all$"
155+
}
156+
],
157+
"example": "192.168.0.11"
158+
},
159+
"access_items": {
160+
"type": "array",
161+
"items": {
162+
"type": "object",
163+
"additionalProperties": false,
164+
"properties": {
165+
"username": {
166+
"type": "string",
167+
"minLength": 1
168+
},
169+
"password": {
170+
"type": "string"
171+
}
172+
},
173+
"example": {
174+
"username": "admin",
175+
"password": "pass"
176+
}
177+
},
178+
"example": [
179+
{
180+
"username": "admin",
181+
"password": "pass"
182+
}
183+
]
184+
},
185+
"access_clients": {
186+
"type": "array",
187+
"items": {
188+
"type": "object",
189+
"additionalProperties": false,
190+
"properties": {
191+
"address": {
192+
"$ref": "#/properties/address"
193+
},
194+
"directive": {
195+
"$ref": "#/properties/directive"
196+
}
197+
},
198+
"example": {
199+
"directive": "allow",
200+
"address": "192.168.0.0/24"
201+
}
202+
},
203+
"example": [
204+
{
205+
"directive": "allow",
206+
"address": "192.168.0.0/24"
207+
}
208+
]
209+
},
210+
"certificate_files": {
211+
"description": "Certificate Files",
212+
"content": {
213+
"multipart/form-data": {
214+
"schema": {
215+
"type": "object",
216+
"additionalProperties": false,
217+
"required": ["certificate", "certificate_key"],
218+
"properties": {
219+
"certificate": {
220+
"type": "string",
221+
"example": "-----BEGIN CERTIFICATE-----\nMIID...-----END CERTIFICATE-----"
222+
},
223+
"certificate_key": {
224+
"type": "string",
225+
"example": "-----BEGIN CERTIFICATE-----\nMIID...-----END CERTIFICATE-----"
226+
},
227+
"intermediate_certificate": {
228+
"type": "string",
229+
"example": "-----BEGIN CERTIFICATE-----\nMIID...-----END CERTIFICATE-----"
230+
}
231+
}
232+
},
233+
"example": {
234+
"certificate": "-----BEGIN CERTIFICATE-----\nMIID...-----END CERTIFICATE-----",
235+
"certificate_key": "-----BEGIN PRIVATE\nMIID...-----END CERTIFICATE-----"
236+
}
237+
}
238+
}
118239
}
119240
}
120241
}
Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"type": "object",
33
"description": "Access List object",
4-
"required": ["id", "created_on", "modified_on", "owner_user_id", "name", "directive", "address", "satisfy_any", "pass_auth", "meta"],
5-
"additionalProperties": false,
4+
"required": ["id", "created_on", "modified_on", "owner_user_id", "name", "meta", "satisfy_any", "pass_auth", "proxy_host_count"],
65
"properties": {
76
"id": {
87
"$ref": "../common.json#/properties/id"
@@ -18,36 +17,25 @@
1817
},
1918
"name": {
2019
"type": "string",
21-
"minLength": 1
20+
"minLength": 1,
21+
"example": "My Access List"
2222
},
23-
"directive": {
24-
"type": "string",
25-
"enum": ["allow", "deny"]
26-
},
27-
"address": {
28-
"oneOf": [
29-
{
30-
"type": "string",
31-
"pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}(/([0-9]|[1-2][0-9]|3[0-2]))?$"
32-
},
33-
{
34-
"type": "string",
35-
"pattern": "^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$"
36-
},
37-
{
38-
"type": "string",
39-
"pattern": "^all$"
40-
}
41-
]
23+
"meta": {
24+
"type": "object",
25+
"example": {}
4226
},
4327
"satisfy_any": {
44-
"type": "boolean"
28+
"type": "boolean",
29+
"example": true
4530
},
4631
"pass_auth": {
47-
"type": "boolean"
32+
"type": "boolean",
33+
"example": false
4834
},
49-
"meta": {
50-
"type": "object"
35+
"proxy_host_count": {
36+
"type": "integer",
37+
"minimum": 0,
38+
"example": 3
5139
}
5240
}
5341
}

backend/schema/components/audit-log-object.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@
2626
"$ref": "../common.json#/properties/user_id"
2727
},
2828
"object_type": {
29-
"type": "string"
29+
"type": "string",
30+
"example": "certificate"
3031
},
3132
"object_id": {
3233
"$ref": "../common.json#/properties/id"
3334
},
3435
"action": {
35-
"type": "string"
36+
"type": "string",
37+
"example": "created"
3638
},
3739
"meta": {
38-
"type": "object"
40+
"type": "object",
41+
"example": {}
3942
},
4043
"user": {
4144
"$ref": "./user-object.json"

backend/schema/components/certificate-object.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
},
2222
"nice_name": {
2323
"type": "string",
24-
"description": "Nice Name for the custom certificate"
24+
"description": "Nice Name for the custom certificate",
25+
"example": "My Custom Cert"
2526
},
2627
"domain_names": {
2728
"description": "Domain Names separated by a comma",
@@ -31,12 +32,14 @@
3132
"items": {
3233
"type": "string",
3334
"pattern": "^[^&| @!#%^();:/\\\\}{=+?<>,~`'\"]+$"
34-
}
35+
},
36+
"example": ["example.com", "www.example.com"]
3537
},
3638
"expires_on": {
3739
"description": "Date and time of expiration",
3840
"readOnly": true,
39-
"type": "string"
41+
"type": "string",
42+
"example": "2025-10-28T04:17:54.000Z"
4043
},
4144
"owner": {
4245
"$ref": "./user-object.json"
@@ -59,16 +62,16 @@
5962
"dns_provider": {
6063
"type": "string"
6164
},
62-
"dns_provider_credentials": {
63-
"type": "string"
64-
},
6565
"letsencrypt_certificate": {
6666
"type": "object"
6767
},
6868
"propagation_seconds": {
6969
"type": "integer",
7070
"minimum": 0
7171
}
72+
},
73+
"example": {
74+
"dns_challenge": false
7275
}
7376
}
7477
}

backend/schema/components/dead-host-object.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,30 @@
3535
"$ref": "../common.json#/properties/http2_support"
3636
},
3737
"advanced_config": {
38-
"type": "string"
38+
"type": "string",
39+
"example": ""
3940
},
4041
"enabled": {
4142
"$ref": "../common.json#/properties/enabled"
4243
},
4344
"meta": {
44-
"type": "object"
45+
"type": "object",
46+
"example": {}
47+
},
48+
"certificate": {
49+
"oneOf": [
50+
{
51+
"type": "null",
52+
"example": null
53+
},
54+
{
55+
"$ref": "./certificate-object.json"
56+
}
57+
],
58+
"example": null
59+
},
60+
"owner": {
61+
"$ref": "./user-object.json"
4562
}
4663
}
4764
}

0 commit comments

Comments
 (0)