Revision 7dc45c57aae0aabd7affa949f74134760c9fd013 authored by avelichk on 10 September 2020, 19:32:55 UTC, committed by avelichk on 10 September 2020, 19:32:55 UTC
1 parent 505f38d
update-openapigen.sh
#!/bin/bash
# Copyright 2019 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
if [[ -z "${GOPATH:-}" ]]; then
export GOPATH=$(go env GOPATH)
fi
PROJECT_ROOT=${GOPATH}/src/github.com/kubeflow/katib
CODEGEN_PKG=${PROJECT_ROOT}/vendor/k8s.io/code-generator
VERSION_LIST=(v1alpha3 v1beta1)
SWAGGER_VERSION="0.1"
for VERSION in ${VERSION_LIST[@]}; do
SWAGGER_CODEGEN_FILE=${PROJECT_ROOT}/pkg/apis/${VERSION}/swagger.json
echo "Generating OpenAPI specification for ${VERSION} ..."
go run ${CODEGEN_PKG}/cmd/openapi-gen/main.go \
--go-header-file ${PROJECT_ROOT}/hack/boilerplate.go.txt \
--input-dirs github.com/kubeflow/katib/pkg/apis/controller/common/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/experiments/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/suggestions/${VERSION},github.com/kubeflow/katib/pkg/apis/controller/trials/${VERSION} \
--output-package github.com/kubeflow/katib/pkg/apis/${VERSION} \
$@
echo "Generating swagger file for ${VERSION} ..."
go run ${PROJECT_ROOT}/hack/swagger/main.go ${VERSION}-${SWAGGER_VERSION} ${VERSION} > ${SWAGGER_CODEGEN_FILE}
done
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...