hack/update-openapi-spec.sh: normalize indention of spec through jq

pull/564/head
Dr. Stefan Schimanski 2019-02-05 17:36:35 +01:00
parent 999e2e0ce8
commit 2393799e2e
2 changed files with 16 additions and 7 deletions

View File

@ -339,10 +339,9 @@ kube::util::create-fake-git-tree() {
kube::util::godep_restored() {
local -r godeps_json=${1:-Godeps/Godeps.json}
local -r gopath=${2:-${GOPATH%:*}}
if ! which jq &>/dev/null; then
echo "jq not found. Please install." 1>&2
return 1
fi
kube::util::require-jq
local root
local old_rev=""
while read path rev; do
@ -792,6 +791,15 @@ function kube::util::check-file-in-alphabetical-order {
fi
}
# kube::util::require-jq
# Checks whether jq is installed.
function kube::util::require-jq {
if ! which jq &>/dev/null; then
echo "jq not found. Please install." 1>&2
return 1
fi
}
# Some useful colors.
if [[ -z "${color_start-}" ]]; then
declare -r color_start="\033["

View File

@ -25,6 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
OPENAPI_ROOT_DIR="${KUBE_ROOT}/api/openapi-spec"
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::util::require-jq
kube::golang::setup_env
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
@ -83,7 +84,7 @@ fi
kube::log::status "Updating " ${OPENAPI_ROOT_DIR}
curl -w "\n" -fs "${API_HOST}:${API_PORT}/openapi/v2" > "${OPENAPI_ROOT_DIR}/swagger.json"
curl -w "\n" -fs "${API_HOST}:${API_PORT}/openapi/v2" | jq -S . > "${OPENAPI_ROOT_DIR}/swagger.json"
kube::log::status "SUCCESS"