File tree 3 files changed +14
-7
lines changed
3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ Experimenting with Kubernetes protobufs.
2
2
3
3
## Build Dependencies
4
4
5
- - [ gron] ( https://github.com/tomnomnom/gron )
6
5
- [ just] ( https://github.com/casey/just )
7
6
- [ sd] ( https://github.com/chmln/sd )
8
7
- [ jq] ( https://stedolan.github.io/jq/ )
Original file line number Diff line number Diff line change @@ -43,12 +43,7 @@ swagger-patch:
43
43
#!/usr/bin/env bash
44
44
set -exuo pipefail
45
45
cd openapi
46
- # Fix path operation annotated with a `x-kubernetes-group-version-kind` that references a type that doesn't exist in the schema.
47
- # See https://github.com/Arnavion/k8s-openapi/blob/445e89ec444ebb1c68e61361e64eec4c4a3f4785/k8s-openapi-codegen/src/fixups/upstream_bugs.rs#L9
48
- gron swagger.json \
49
- | perl -pe ' s/(?<=kind = ")(Pod|Node|Service)(?:Attach|Exec|PortForward|Proxy)Options(?=")/$1/' \
50
- | gron -u \
51
- > swagger-patched.json
46
+ jq -f patches/ patch-nonexistent-gvk.jq < swagger.json > swagger-patched.json
52
47
mv swagger-patched.json swagger.json
53
48
54
49
# Transform swagger schema into api-resources.json
Original file line number Diff line number Diff line change
1
+ # Fix path operation annotated with a `x-kubernetes-group-version-kind` that references a type that doesn't exist in the schema.
2
+ # See https://github.com/Arnavion/k8s-openapi/blob/445e89ec444ebb1c68e61361e64eec4c4a3f4785/k8s-openapi-codegen/src/fixups/upstream_bugs.rs#L9
3
+ (.paths | .. | objects | select ((.group ? == "" ) and (.version ? == "v1" ) and (.kind ? | type ) == "string" )).kind |= (
4
+ if . | test ("^Pod(?:Attach|Exec|PortForward|Proxy)Options$" ) then
5
+ "Pod"
6
+ elif . == "NodeProxyOptions" then
7
+ "Node"
8
+ elif . == "ServiceProxyOptions" then
9
+ "Service"
10
+ else
11
+ .
12
+ end
13
+ )
You can’t perform that action at this time.
0 commit comments