-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.json
80 lines (80 loc) · 2.44 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
"$id": "webserv_config",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "miniRT",
"description": "config for webserv",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"type": "object",
"unevaluatedProperties": false,
"properties": {
"servers": { "type": "array", "items": { "$ref": "#/$defs/server" } }
}
},
"server": {
"type": "object",
"unevaluatedProperties": false,
"properties": {
"host": {
"type": "string",
"pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"
},
"port": { "type": "integer", "min": 1, "max": 65535 },
"root": { "$ref": "#/$defs/route" }
},
"required": ["port"]
},
"route": {
"type": "object",
"unevaluatedProperties": false,
"oneOf": [
{ "$ref": "#/$defs/file-route" },
{ "$ref": "#/$defs/cgi-route" }
]
},
"file-route": {
"type": "object",
"unevaluatedProperties": false,
"properties": {
"type": { "type": "string", "enum": ["file"] },
"path": { "type": "string", "description": "http route path segment" },
"root": { "type": "string", "description": "path to file system root" },
"methods": {
"type": "object",
"unevaluatedProperties": false,
"properties": {
"GET": { "type": "boolean" },
"HEAD": { "type": "boolean" },
"OPTIONS": { "type": "boolean" },
"POST": { "type": "boolean" },
"PUT": { "type": "boolean" },
"PATCH": { "type": "boolean" },
"DELETE": { "type": "boolean" },
"TRACE": { "type": "boolean" }
}
},
"directoryListing": { "type": "boolean" },
"routes": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/route" }
}
},
"required": ["type", "path"]
},
"cgi-route": {
"type": "object",
"unevaluatedProperties": false,
"properties": {
"type": { "type": "string", "enum": ["cgi"] },
"path": { "type": "string" },
"rule": { "type": "array", "items": { "type": "string" } },
"routes": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/route" }
}
},
"required": ["type", "path", "rule"]
}
}
}