Skip to content

Commit 719e09e

Browse files
committed
refactor: regenerate docs and adjust json schema definition
1 parent cd0b3b8 commit 719e09e

File tree

19 files changed

+438
-138
lines changed

19 files changed

+438
-138
lines changed

htsget-config/docs/examples/default.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ expose_headers = "All"
2525
[service_info]
2626

2727
[[locations]]
28-
prefix = ""
28+
append_to = ""
2929

30-
[locations.backend]
30+
[locations.location]
3131
kind = "File"
3232
scheme = "HTTP"
3333
authority = "127.0.0.1:8081"

htsget-config/docs/generate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
set -euxo pipefail
44

55
# Update the default config toml and authorization response schema.
6-
cargo run -p htsget-axum -- -p > examples/default.toml
7-
cargo run -p htsget-axum -- -s > schemas/auth.schema.json
6+
cargo run -p htsget-axum --all-features -- -p > examples/default.toml
7+
cargo run -p htsget-axum --all-features -- -s > schemas/auth.schema.json
88
pre-commit run --files schemas/auth.schema.json examples/default.toml || true

htsget-config/docs/schemas/auth.schema.json

Lines changed: 287 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
"description": "Authorization restrictions from an external authorization service.",
55
"type": "object",
66
"properties": {
7+
"version": {
8+
"description": "The version of the schema.",
9+
"type": "integer",
10+
"format": "uint32",
11+
"minimum": 1
12+
},
713
"htsgetAuth": {
814
"description": "The authorization rules.",
915
"type": "array",
1016
"items": {
1117
"$ref": "#/$defs/AuthorizationRule"
1218
},
1319
"minItems": 1
14-
},
15-
"version": {
16-
"description": "The version of the schema.",
17-
"type": "integer",
18-
"format": "uint32",
19-
"minimum": 1
2020
}
2121
},
2222
"additionalProperties": false,
@@ -26,12 +26,11 @@
2626
"description": "Individual authorization rule defining access permissions.",
2727
"type": "object",
2828
"properties": {
29-
"path": {
30-
"description": "The path that the authorization applies to. This should not contain the `/reads` or `/variants` component of the path, and it can be a regex.",
31-
"type": "string",
32-
"minLength": 1
29+
"location": {
30+
"description": "The location that the authorization applies to.",
31+
"$ref": "#/$defs/Location"
3332
},
34-
"referenceNames": {
33+
"rules": {
3534
"description": "The reference name restrictions to apply to this path.",
3635
"type": ["array", "null"],
3736
"items": {
@@ -40,22 +39,278 @@
4039
}
4140
},
4241
"additionalProperties": false,
43-
"required": ["path"]
42+
"required": ["location"]
4443
},
45-
"Format": {
46-
"description": "An enumeration with all the possible formats.",
44+
"Location": {
45+
"description": "Either simple or regex based location.",
46+
"anyOf": [
47+
{
48+
"description": "Use a simple location.",
49+
"$ref": "#/$defs/SimpleLocation"
50+
},
51+
{
52+
"description": "Use a regex location.",
53+
"$ref": "#/$defs/RegexLocation"
54+
}
55+
]
56+
},
57+
"SimpleLocation": {
58+
"description": "A simple location config.",
59+
"anyOf": [
60+
{
61+
"$ref": "#/$defs/StringLocation"
62+
}
63+
]
64+
},
65+
"StringLocation": {
66+
"description": "Deserialize the location from a string with a protocol and either a prefix or exact id match logic.",
67+
"type": "object",
68+
"properties": {
69+
"location": {
70+
"description": "The location, which should start with `file://`, `s3://`, `http://` or `https://`.",
71+
"type": ["string", "null"],
72+
"default": null
73+
}
74+
},
75+
"unevaluatedProperties": false,
76+
"oneOf": [
77+
{
78+
"description": "Use prefix matching logic, where the requested id should start with the prefix.",
79+
"type": "object",
80+
"properties": {
81+
"prefix": {
82+
"type": "string"
83+
}
84+
},
85+
"required": ["prefix"]
86+
},
87+
{
88+
"description": "Use exact id matching logic, where the requested id should be equal to this id.",
89+
"type": "object",
90+
"properties": {
91+
"id": {
92+
"type": "string"
93+
}
94+
},
95+
"required": ["id"]
96+
}
97+
]
98+
},
99+
"RegexLocation": {
100+
"description": "Specify that the location is a regex location that can arbitrarily map IDs using regex strings.",
101+
"type": "object",
102+
"properties": {
103+
"regex": {
104+
"description": "The regex to match the id against.",
105+
"type": ["string", "null"]
106+
},
107+
"substitution_string": {
108+
"description": "A substitution string to find the data when using a location.",
109+
"type": ["string", "null"],
110+
"default": null
111+
},
112+
"backend": {
113+
"description": "The backend of the location if configured.",
114+
"anyOf": [
115+
{
116+
"$ref": "#/$defs/Backend"
117+
},
118+
{
119+
"type": "null"
120+
}
121+
],
122+
"default": null
123+
}
124+
},
125+
"additionalProperties": false
126+
},
127+
"Backend": {
128+
"description": "Specify the storage backend to use as config values.",
129+
"oneOf": [
130+
{
131+
"description": "Configure the server to fetch data and return tickets from a local filesystem.",
132+
"type": "object",
133+
"properties": {
134+
"scheme": {
135+
"description": "The ticket response scheme to the data server.",
136+
"$ref": "#/$defs/Scheme",
137+
"default": "HTTP"
138+
},
139+
"authority": {
140+
"description": "The authority of the data server.",
141+
"type": "string",
142+
"default": "127.0.0.1:8081"
143+
},
144+
"local_path": {
145+
"description": "The local path to serve files from.",
146+
"type": "string",
147+
"default": "./"
148+
},
149+
"keys": {
150+
"description": "Configure the server to fetch data and return tickets from S3.",
151+
"anyOf": [
152+
{
153+
"$ref": "#/$defs/C4GHKeys"
154+
},
155+
{
156+
"type": "null"
157+
}
158+
],
159+
"writeOnly": true
160+
},
161+
"ticket_origin": {
162+
"description": "The origin of the tickets, which can be different to the data server address.",
163+
"type": ["string", "null"],
164+
"default": null
165+
},
166+
"kind": {
167+
"type": "string",
168+
"const": "File"
169+
}
170+
},
171+
"additionalProperties": false,
172+
"required": ["kind"]
173+
},
174+
{
175+
"description": "Configure the server to fetch data and return tickets from S3.",
176+
"type": "object",
177+
"properties": {
178+
"bucket": {
179+
"description": "The bucket to use.",
180+
"type": "string",
181+
"default": ""
182+
},
183+
"endpoint": {
184+
"description": "The S3 endpoint to use.",
185+
"type": ["string", "null"],
186+
"default": null
187+
},
188+
"path_style": {
189+
"description": "Whether path style or virtual host addressing should be used.",
190+
"type": "boolean",
191+
"default": false
192+
},
193+
"keys": {
194+
"description": "Optional Crypt4GH keys to use when decrypting data.",
195+
"anyOf": [
196+
{
197+
"$ref": "#/$defs/C4GHKeys"
198+
},
199+
{
200+
"type": "null"
201+
}
202+
],
203+
"writeOnly": true
204+
},
205+
"kind": {
206+
"type": "string",
207+
"const": "S3"
208+
}
209+
},
210+
"additionalProperties": false,
211+
"required": ["kind"]
212+
},
213+
{
214+
"description": "Configure the server to reach out to a remote URL to fetch data.",
215+
"type": "object",
216+
"properties": {
217+
"url": {
218+
"type": "string",
219+
"default": "/"
220+
},
221+
"response_url": {
222+
"type": ["string", "null"],
223+
"default": null
224+
},
225+
"forward_headers": {
226+
"type": "boolean",
227+
"default": true
228+
},
229+
"header_blacklist": {
230+
"type": "array",
231+
"items": {
232+
"type": "string"
233+
},
234+
"default": []
235+
},
236+
"keys": {
237+
"anyOf": [
238+
{
239+
"$ref": "#/$defs/C4GHKeys"
240+
},
241+
{
242+
"type": "null"
243+
}
244+
],
245+
"writeOnly": true
246+
},
247+
"kind": {
248+
"type": "string",
249+
"const": "Url"
250+
}
251+
},
252+
"additionalProperties": false,
253+
"required": ["kind"]
254+
}
255+
]
256+
},
257+
"Scheme": {
258+
"description": "Schemes that can be used with htsget.",
47259
"type": "string",
48-
"enum": ["Bam", "Cram", "Vcf", "Bcf"]
260+
"enum": ["HTTP", "HTTPS"]
261+
},
262+
"C4GHKeys": {
263+
"description": "Specifies the location of a Crypt4GH key.",
264+
"oneOf": [
265+
{
266+
"description": "Obtain keys from a local file.",
267+
"type": "object",
268+
"properties": {
269+
"private": {
270+
"description": "The path to the private key.",
271+
"type": "string"
272+
},
273+
"public": {
274+
"description": "The path to the public key.",
275+
"type": "string"
276+
},
277+
"kind": {
278+
"type": "string",
279+
"const": "File"
280+
}
281+
},
282+
"additionalProperties": false,
283+
"required": ["kind", "private", "public"]
284+
},
285+
{
286+
"description": "Obtain keys from AWS secrets manager.",
287+
"type": "object",
288+
"properties": {
289+
"private": {
290+
"description": "The ARN or name of the secret holding the private key.",
291+
"type": "string"
292+
},
293+
"public": {
294+
"description": "The ARN or name of the secret holding the public key.",
295+
"type": "string"
296+
},
297+
"kind": {
298+
"type": "string",
299+
"const": "SecretsManager"
300+
}
301+
},
302+
"additionalProperties": false,
303+
"required": ["kind", "private", "public"]
304+
}
305+
]
49306
},
50307
"ReferenceNameRestriction": {
51308
"description": "Restriction on genomic reference names and coordinate ranges.",
52309
"type": "object",
53310
"properties": {
54-
"end": {
55-
"description": "The end interval (0-based, exclusive).",
56-
"type": ["integer", "null"],
57-
"format": "uint32",
58-
"minimum": 0
311+
"referenceName": {
312+
"description": "The reference name to allow. Allows all reference names if unspecified.",
313+
"type": ["string", "null"]
59314
},
60315
"format": {
61316
"description": "The format to allow. Allows all formats if unspecified.",
@@ -68,20 +323,25 @@
68323
}
69324
]
70325
},
71-
"name": {
72-
"description": "The reference name to allow.",
73-
"type": "string",
74-
"minLength": 1
75-
},
76326
"start": {
77327
"description": "The start interval (0-based, inclusive).",
78328
"type": ["integer", "null"],
79329
"format": "uint32",
80330
"minimum": 0
331+
},
332+
"end": {
333+
"description": "The end interval (0-based, exclusive).",
334+
"type": ["integer", "null"],
335+
"format": "uint32",
336+
"minimum": 0
81337
}
82338
},
83-
"additionalProperties": false,
84-
"required": ["name"]
339+
"additionalProperties": false
340+
},
341+
"Format": {
342+
"description": "An enumeration with all the possible formats.",
343+
"type": "string",
344+
"enum": ["Bam", "Cram", "Vcf", "Bcf"]
85345
}
86346
}
87347
}

0 commit comments

Comments
 (0)