-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.dist.yaml
48 lines (43 loc) · 1.33 KB
/
Taskfile.dist.yaml
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
version: 3
tasks:
spec:hosted:
desc: "Populate Antrhopic's OpenAPI spec from a hosted source"
vars:
input_file: tmp-ref.yaml
output_name: hosted_spec
cmds:
- task: download:anthropic
- "url=$(grep -oP '(?<=openapi_spec_url: ).*' {{.input_file}}) && curl -o {{.output_name}}.json $url"
- task: spec:fix
vars:
FILENAME: "{{.output_name}}.json"
- task: spec:downgrade
vars:
FILENAME: "{{.output_name}}.json"
spec:downgrade:
desc: "Downgrade the OpenAPI spec to v3.0.0"
vars:
FILENAME: '{{.FILENAME| default "spec.json"}}'
cmds:
- python downgrade_spec.py --file {{.FILENAME}}
spec:fix:
desc: "Fix the OpenAPI spec"
vars:
FILENAME: '{{.FILENAME| default "spec.json"}}'
cmds:
- python fix_spec.py --file {{.FILENAME}}
download:anthropic:
vars:
ref_url: https://raw.githubusercontent.com/anthropics/anthropic-sdk-typescript/refs/heads/main/.stats.yml
desc: "Download the latest version of the Anthropic OpenAPI spec"
status:
- test -f tmp-ref.yaml
cmds:
- curl -o tmp-ref.yaml {{.ref_url}}
utils:convert:
desc: "Convert a JSON file to YAML"
preconditions:
- test -f {{.input}}
- yq --version
cmds:
- yq eval -P -o=yaml {{.input}} | tee {{.output}}