refactor: replace api.yml with copy downloaded from openapi repo (#43)

This commit is contained in:
Daniel Moran
2021-04-26 10:46:02 -04:00
committed by GitHub
parent 73dc5ef63b
commit 1aa715df05
3 changed files with 10 additions and 520 deletions

View File

@ -4,6 +4,12 @@ declare -r ETC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
declare -r ROOT_DIR="$(dirname ${ETC_DIR})"
declare -r GENERATOR_DOCKER_IMG=openapitools/openapi-generator-cli:v5.1.0
declare -r OPENAPI_COMMIT=5ab3ef0b9a6aee68b3b34e1858ca6d55c153650a
# Download our target API spec.
# NOTE: openapi-generator supports HTTP references to API docs, but using that feature
# causes the host of the URL to be injected into the base paths of generated code.
curl -o ${ROOT_DIR}/internal/api/cli.yml https://raw.githubusercontent.com/influxdata/openapi/${OPENAPI_COMMIT}/contracts/cli.yml
# Run the generator - This produces many more files than we want to track in git.
docker run --rm -it -u "$(id -u):$(id -g)" \
@ -11,7 +17,7 @@ docker run --rm -it -u "$(id -u):$(id -g)" \
${GENERATOR_DOCKER_IMG} \
generate \
-g go \
-i /influx/internal/api/api.yml \
-i /influx/internal/api/cli.yml \
-o /influx/internal/api \
-t /influx/internal/api/templates \
--additional-properties packageName=api,enumClassPrefix=true,generateInterfaces=true