-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpatch.jq
More file actions
13 lines (10 loc) · 758 Bytes
/
patch.jq
File metadata and controls
13 lines (10 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
# Change components' schema definitions
.components.schemas."Instance Flavor Fields".properties.ram.type = "number" |
.components.schemas."Flavor Fields".properties.ram.type = "number" |
.components.schemas."Volume Fields".properties.size.type = "integer" |
# Remove spaces in schema definitions to conform with the specs
.components.schemas |= (to_entries | map({key: (.key | gsub(" |%20"; "")), value: .value}) | from_entries) |
# Fix references to these schemas
walk(if type == "object" then with_entries( if .key == "$ref" then .value |= gsub(" |%20"; "") else . end) else . end) |
# Remove duplicate tags
.tags |= (map(.key = .name | .value = .description) | from_entries | to_entries | map(.name = .key | .description = .value | del(.key, .value)))