OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
23.99k stars 6.98k forks source link

[BUG] docker-entrypoint.sh fails with error if no parameters passed #6206

Open digininja opened 5 years ago

digininja commented 5 years ago

Bug Report Checklist

Description

If no command line argument is passed to docker-entrypoint.sh, when it tries to use $1 on lines 18 and 22 it fails with the error:

./docker-entrypoint.sh: line 22: $1: unbound variable
openapi-generator version

Latest master from Git

OpenAPI declaration file content or url

n/a

Command line used for generation

n/a

Steps to reproduce
$ ./run-in-docker.sh 
++ dirname ./run-in-docker.sh
+ cd .
+ maven_cache_repo=/home/robin/.m2/repository
+ mkdir -p /home/robin/.m2/repository
++ id -u
++ id -g
+ docker run --rm -it -w /gen -e GEN_DIR=/gen -e MAVEN_CONFIG=/var/maven/.m2 -e 'MAVEN_OPTS=-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=/var/maven/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true' -u 1000:1000 -v /tmp/openapi-generator-4.3.1x:/gen -v /tmp/openapi-generator-4.3.1x/CI/run-in-docker-settings.xml:/var/maven/.m2/settings.xml -v /home/robin/.m2/repository:/var/maven/.m2/repository --entrypoint /gen/docker-entrypoint.sh maven:3-jdk-8
/gen/docker-entrypoint.sh: line 18: $1: unbound variable
/gen/docker-entrypoint.sh: line 22: $1: unbound variable
Related issues/PRs

Could not find any

Suggest a fix

I'm submitting a PR to go with this as one way to fix it, but there may be better ways.

digininja commented 5 years ago

PR is https://github.com/OpenAPITools/openapi-generator/pull/6207