forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/3.2.x' into 4.0.x
This commit is contained in:
commit
deb5dcaad1
3
.gitignore
vendored
3
.gitignore
vendored
@ -158,6 +158,9 @@ samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
|
|||||||
samples/client/petstore/python/.coverage
|
samples/client/petstore/python/.coverage
|
||||||
samples/client/petstore/python/.projectile
|
samples/client/petstore/python/.projectile
|
||||||
samples/client/petstore/python/.venv/
|
samples/client/petstore/python/.venv/
|
||||||
|
samples/client/petstore/python-asyncio/.venv/
|
||||||
|
samples/client/petstore/python-asyncio/.pytest_cache/
|
||||||
|
samples/client/petstore/python-tornado/.venv/
|
||||||
|
|
||||||
# ts
|
# ts
|
||||||
samples/client/petstore/typescript-node/npm/node_modules
|
samples/client/petstore/typescript-node/npm/node_modules
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/rails5 -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/rails5 $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
32
bin/openapi3/ruby-client-petstore.sh
Executable file
32
bin/openapi3/ruby-client-petstore.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
echo "# START SCRIPT: $SCRIPT"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -27,6 +27,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/ruby -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore-security-test/ruby $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-on-rails-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/ruby-on-rails $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
@ -27,6 +27,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/ruby -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-sinatra-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/ruby-sinatra $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
6
bin/python-petstore-all.sh
Executable file
6
bin/python-petstore-all.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# update python petstore clients
|
||||||
|
|
||||||
|
./bin/python-asyncio-petstore.sh
|
||||||
|
./bin/python-petstore.sh
|
||||||
|
./bin/python-tornado-petstore.sh
|
32
bin/ruby-client-petstore.sh
Executable file
32
bin/ruby-client-petstore.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
echo "# START SCRIPT: $SCRIPT"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn -B clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -27,6 +27,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/ruby -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-on-rails-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/ruby-on-rails $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
@ -27,6 +27,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/rails5 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-on-rails -o samples/server/petstore/rails5 $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-sinatra-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/ruby-sinatra $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
@ -27,6 +27,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/sinatra -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/sinatra $@"
|
ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g ruby -c bin/ruby-petstore.json -o samples/client/petstore-security-test/ruby $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
@ -1,32 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
SCRIPT="$0"
|
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
|
||||||
|
|
||||||
while [ -h "$SCRIPT" ] ; do
|
|
||||||
ls=`ls -ld "$SCRIPT"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
SCRIPT="$link"
|
|
||||||
else
|
|
||||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d "${APP_DIR}" ]; then
|
|
||||||
APP_DIR=`dirname "$SCRIPT"`/..
|
|
||||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
|
||||||
fi
|
|
||||||
|
|
||||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
|
||||||
|
|
||||||
if [ ! -f "$executable" ]
|
|
||||||
then
|
|
||||||
mvn -B clean package
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
ags="generate -t modules/openapi-generator/src/main/resources/sinatra -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby-sinatra -o samples/server/petstore/sinatra $@"
|
|
||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
|
@ -17,9 +17,9 @@ sleep 5
|
|||||||
./bin/kotlin-client-petstore.sh > /dev/null 2>&1
|
./bin/kotlin-client-petstore.sh > /dev/null 2>&1
|
||||||
./bin/kotlin-client-string.sh > /dev/null 2>&1
|
./bin/kotlin-client-string.sh > /dev/null 2>&1
|
||||||
./bin/kotlin-client-threetenbp.sh > /dev/null 2>&1
|
./bin/kotlin-client-threetenbp.sh > /dev/null 2>&1
|
||||||
./bin/kotlin-server-petstore.shl> /dev/null 2>&1
|
./bin/kotlin-server-petstore.sh > /dev/null 2>&1
|
||||||
./bin/php-petstore.sh > /dev/null 2>&1
|
./bin/php-petstore.sh > /dev/null 2>&1
|
||||||
./bin/php-silex-petstore-server.shj> /dev/null 2>&1
|
./bin/php-silex-petstore-server.sh > /dev/null 2>&1
|
||||||
./bin/php-symfony-petstore.sh > /dev/null 2>&1
|
./bin/php-symfony-petstore.sh > /dev/null 2>&1
|
||||||
./bin/php-lumen-petstore-server.sh > /dev/null 2>&1
|
./bin/php-lumen-petstore-server.sh > /dev/null 2>&1
|
||||||
./bin/php-slim-petstore-server.sh > /dev/null 2>&1
|
./bin/php-slim-petstore-server.sh > /dev/null 2>&1
|
||||||
|
196
bin/utils/release_checkout.rb
Executable file
196
bin/utils/release_checkout.rb
Executable file
@ -0,0 +1,196 @@
|
|||||||
|
#release_chekcout.rb
|
||||||
|
require 'rubygems'
|
||||||
|
require 'open-uri'
|
||||||
|
require 'net/http'
|
||||||
|
|
||||||
|
def check_homebrew
|
||||||
|
print "Checking homebrew forumla ... "
|
||||||
|
|
||||||
|
url = "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/openapi-generator.rb"
|
||||||
|
new_maven_url = "https://search.maven.org/remotecontent?filepath=org/openapitools/openapi-generator-cli/#{$version}/openapi-generator-cli-#{$version}.jar"
|
||||||
|
open(url) do |f|
|
||||||
|
content = f.read
|
||||||
|
if !content.nil? && content.include?(new_maven_url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not yet updated with #{new_maven_url}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_online_docker
|
||||||
|
print "Checking openapi-generator-online docker ... "
|
||||||
|
|
||||||
|
url = "https://hub.docker.com/r/openapitools/openapi-generator-online/tags/"
|
||||||
|
docker_tag = "v#{$version}"
|
||||||
|
open(url) do |f|
|
||||||
|
content = f.read
|
||||||
|
if !content.nil? && content.include?(docker_tag)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} does not have tag #{docker_tag}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_cli_docker
|
||||||
|
print "Checking openapi-generator-cli docker ... "
|
||||||
|
|
||||||
|
url = "https://hub.docker.com/r/openapitools/openapi-generator-cli/tags/"
|
||||||
|
docker_tag = "v#{$version}"
|
||||||
|
open(url) do |f|
|
||||||
|
content = f.read
|
||||||
|
if !content.nil? && content.include?(docker_tag)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} does not have tag #{docker_tag}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_readme
|
||||||
|
print "Checking openapi-generator README.md ... "
|
||||||
|
|
||||||
|
url = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/README.md"
|
||||||
|
matches = ["[#{$version}](https://github.com/OpenAPITools/openapi-generator/releases/tag/v#{$version})",
|
||||||
|
"JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/#{$version}/openapi-generator-cli-#{$version}.jar`",
|
||||||
|
"wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/#{$version}/openapi-generator-cli-#{$version}.jar -O openapi-generator-cli.jar",
|
||||||
|
"Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/#{$version}/openapi-generator-cli-#{$version}.jar"]
|
||||||
|
open(url) do |f|
|
||||||
|
content = f.read
|
||||||
|
has_outdated = false
|
||||||
|
not_matched = []
|
||||||
|
matches.each do |match|
|
||||||
|
if !content.nil? && content.include?(match)
|
||||||
|
# matched
|
||||||
|
else
|
||||||
|
has_outdated = true
|
||||||
|
not_matched << match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if has_outdated
|
||||||
|
puts "[ERROR]"
|
||||||
|
not_matched.each do |str|
|
||||||
|
puts "> '#{str}' not found in README.md"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "[OK]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_jar
|
||||||
|
print "Checking openapi-generator JAR ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator/#{$version}/openapi-generator-#{$version}.jar"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def check_openapi_generator_cli_jar
|
||||||
|
print "Checking openapi-generator-cli JAR ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/#{$version}/openapi-generator-cli-#{$version}.jar"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_maven_plugin_jar
|
||||||
|
print "Checking openapi-generator-maven-plugin JAR ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator-maven-plugin/#{$version}/openapi-generator-maven-plugin-#{$version}.jar"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_gradle_plugin_jar
|
||||||
|
print "Checking openapi-generator-gradle-plugin JAR ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator-gradle-plugin/#{$version}/openapi-generator-gradle-plugin-#{$version}.jar"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_online_jar
|
||||||
|
print "Checking openapi-generator-online JAR ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator-online/#{$version}/openapi-generator-online-#{$version}.jar"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_openapi_generator_project_pom
|
||||||
|
print "Checking openapi-generator-project pom.xml ... "
|
||||||
|
url = "http://central.maven.org/maven2/org/openapitools/openapi-generator-project/#{$version}/openapi-generator-project-#{$version}.pom"
|
||||||
|
|
||||||
|
if check_url(url)
|
||||||
|
puts "[OK]"
|
||||||
|
else
|
||||||
|
puts "[ERROR]"
|
||||||
|
puts "> #{url} not found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_url url
|
||||||
|
content = Net::HTTP.get(URI.parse(url))
|
||||||
|
url = URI.parse(url)
|
||||||
|
req = Net::HTTP.new(url.host, url.port)
|
||||||
|
res = req.request_head(url.path)
|
||||||
|
if res.code == "200"
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def usage
|
||||||
|
puts "ERROR!! Version (e.g. 3.0.2) missing"
|
||||||
|
puts "Usage example: ruby #{$0} 3.0.2"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if (!ARGV[0])
|
||||||
|
usage
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
|
$version = ARGV[0]
|
||||||
|
|
||||||
|
puts "Running checkout on OpenAPI Generator release #{$version}"
|
||||||
|
|
||||||
|
check_homebrew
|
||||||
|
check_openapi_generator_jar
|
||||||
|
check_openapi_generator_cli_jar
|
||||||
|
check_openapi_generator_maven_plugin_jar
|
||||||
|
check_openapi_generator_gradle_plugin_jar
|
||||||
|
check_openapi_generator_online_jar
|
||||||
|
check_openapi_generator_project_pom
|
||||||
|
check_readme
|
||||||
|
check_openapi_generator_online_docker
|
||||||
|
check_openapi_generator_cli_docker
|
45
circle.yml
45
circle.yml
@ -12,6 +12,13 @@ jobs:
|
|||||||
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
DOCKER_GENERATOR_IMAGE_NAME: openapitools/openapi-generator
|
||||||
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
DOCKER_CODEGEN_CLI_IMAGE_NAME: openapitools/openapi-generator-cli
|
||||||
steps:
|
steps:
|
||||||
|
# Restore the dependency cache
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
# Default branch if not
|
||||||
|
- source-v1-{{ .Branch }}-{{ .Revision }}
|
||||||
|
- source-v1-{{ .Branch }}-
|
||||||
|
- source-v1-
|
||||||
# Machine Setup
|
# Machine Setup
|
||||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||||
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
|
||||||
@ -31,13 +38,6 @@ jobs:
|
|||||||
' | sudo tee -a /etc/hosts
|
' | sudo tee -a /etc/hosts
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# This would typically go in either a build or a build-and-test job when using workflows
|
# This would typically go in either a build or a build-and-test job when using workflows
|
||||||
# Restore the dependency cache
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
# This branch if available
|
|
||||||
- v1-dep-{{ .Branch }}-
|
|
||||||
# Default branch if not
|
|
||||||
- v1-dep-master-
|
|
||||||
# This is based on your 1.0 configuration file or project settings
|
# This is based on your 1.0 configuration file or project settings
|
||||||
- run: sudo add-apt-repository ppa:duggan/bats --yes
|
- run: sudo add-apt-repository ppa:duggan/bats --yes
|
||||||
- run: sudo apt-get update -qq
|
- run: sudo apt-get update -qq
|
||||||
@ -67,9 +67,22 @@ jobs:
|
|||||||
- run: cat /etc/hosts
|
- run: cat /etc/hosts
|
||||||
# This is based on your 1.0 configuration file or project settings
|
# This is based on your 1.0 configuration file or project settings
|
||||||
- run: cp CI/pom.xml.circleci pom.xml
|
- run: cp CI/pom.xml.circleci pom.xml
|
||||||
|
# Test
|
||||||
|
# This would typically be a build job when using workflows, possibly combined with build
|
||||||
|
# This is based on your 1.0 configuration file or project settings
|
||||||
|
#- run: java -version
|
||||||
|
- run: mvn --quiet clean install
|
||||||
|
- run: mvn --quiet verify -Psamples
|
||||||
|
- run: if [ $? -ne 0 ]; then exit 1; fi
|
||||||
|
- run: sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
||||||
|
- run: java -version
|
||||||
|
- run: cp CI/pom.xml.circleci.java7 pom.xml
|
||||||
|
- run: mvn --quiet clean install
|
||||||
|
- run: mvn --quiet verify -Psamples
|
||||||
|
- run: if [ $? -ne 0 ]; then exit 1; fi
|
||||||
# Save dependency cache
|
# Save dependency cache
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: v1-dep-{{ .Branch }}
|
key: source-v1-{{ .Branch }}-{{ .Revision }}
|
||||||
paths:
|
paths:
|
||||||
# This is a broad list of cache paths to include many possible development environments
|
# This is a broad list of cache paths to include many possible development environments
|
||||||
# You can probably delete some of these entries
|
# You can probably delete some of these entries
|
||||||
@ -81,21 +94,7 @@ jobs:
|
|||||||
- ~/.go_workspace
|
- ~/.go_workspace
|
||||||
- ~/.gradle
|
- ~/.gradle
|
||||||
- ~/.cache/bower
|
- ~/.cache/bower
|
||||||
# These cache paths were specified in the 1.0 config
|
- ".git"
|
||||||
- ~/.sbt
|
|
||||||
# Test
|
|
||||||
# This would typically be a build job when using workflows, possibly combined with build
|
|
||||||
# This is based on your 1.0 configuration file or project settings
|
|
||||||
- run: java -version
|
|
||||||
- run: mvn --quiet clean install
|
|
||||||
- run: mvn --quiet verify -Psamples
|
|
||||||
- run: if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
- run: sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
|
||||||
- run: java -version
|
|
||||||
- run: cp CI/pom.xml.circleci.java7 pom.xml
|
|
||||||
- run: mvn --quiet clean install
|
|
||||||
- run: mvn --quiet verify -Psamples
|
|
||||||
- run: if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
# Teardown
|
# Teardown
|
||||||
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
|
||||||
# Save test results
|
# Save test results
|
||||||
|
@ -37,3 +37,6 @@ Swagger is a trademark owned by SmartBear and the use of the term "Swagger" foun
|
|||||||
|
|
||||||
OpenAPI Generator is based on Swagger Codegen 2.4.0-SNAPSHOT version so the migration should be easy, straightforward and almost seamless. Please refer to the [migration guide](migration-from-swagger-codegen.md) for more information.
|
OpenAPI Generator is based on Swagger Codegen 2.4.0-SNAPSHOT version so the migration should be easy, straightforward and almost seamless. Please refer to the [migration guide](migration-from-swagger-codegen.md) for more information.
|
||||||
|
|
||||||
|
#### May I know who maintains this Q&A page?
|
||||||
|
|
||||||
|
This Q&A page is maintained by the [core team members](../README.md#openapi-generator-core-team). It's not maintained by a single person nor do these Q&As represent the view of an individual.
|
||||||
|
@ -19,6 +19,7 @@ package org.openapitools.codegen;
|
|||||||
|
|
||||||
import io.airlift.airline.Cli;
|
import io.airlift.airline.Cli;
|
||||||
import io.airlift.airline.Help;
|
import io.airlift.airline.Help;
|
||||||
|
import io.airlift.airline.ParseArgumentsUnexpectedException;
|
||||||
import io.airlift.airline.ParseOptionMissingException;
|
import io.airlift.airline.ParseOptionMissingException;
|
||||||
import io.airlift.airline.ParseOptionMissingValueException;
|
import io.airlift.airline.ParseOptionMissingValueException;
|
||||||
import org.openapitools.codegen.cmd.*;
|
import org.openapitools.codegen.cmd.*;
|
||||||
@ -67,6 +68,9 @@ public class OpenAPIGenerator {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
} catch (ParseArgumentsUnexpectedException e) {
|
||||||
|
System.err.printf("[error] %s%n%nSee 'openapi-generator-cli help' for usage.%n", e.getMessage());
|
||||||
|
System.exit(1);
|
||||||
} catch (ParseOptionMissingException | ParseOptionMissingValueException e) {
|
} catch (ParseOptionMissingException | ParseOptionMissingValueException e) {
|
||||||
System.err.printf("[error] %s%n", e.getMessage());
|
System.err.printf("[error] %s%n", e.getMessage());
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -198,31 +198,16 @@
|
|||||||
<guava-version>20.0</guava-version>
|
<guava-version>20.0</guava-version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger.core.v3</groupId>
|
|
||||||
<artifactId>swagger-models</artifactId>
|
|
||||||
<version>${swagger-core-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger.core.v3</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>swagger-core</artifactId>
|
<artifactId>swagger-core</artifactId>
|
||||||
<version>${swagger-core-version}</version>
|
<version>${swagger-core-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger.parser.v3</groupId>
|
<groupId>io.swagger.parser.v3</groupId>
|
||||||
<artifactId>swagger-parser-core</artifactId>
|
<artifactId>swagger-parser</artifactId>
|
||||||
<version>${swagger-parser-version}</version>
|
<version>${swagger-parser-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger.parser.v3</groupId>
|
|
||||||
<artifactId>swagger-parser-v3</artifactId>
|
|
||||||
<version>${swagger-parser-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.swagger.parser.v3</groupId>
|
|
||||||
<artifactId>swagger-parser</artifactId>
|
|
||||||
<version>${swagger-parser-version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.samskivert</groupId>
|
<groupId>com.samskivert</groupId>
|
||||||
<artifactId>jmustache</artifactId>
|
<artifactId>jmustache</artifactId>
|
||||||
|
@ -4373,19 +4373,16 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (schema.getAdditionalProperties() != null) {// http body is map
|
if (schema.getAdditionalProperties() != null) {// http body is map
|
||||||
LOGGER.error("Map should be supported. Please report to openapi-generator github repo about the issue.");
|
LOGGER.error("Map should be supported. Please report to openapi-generator github repo about the issue.");
|
||||||
} else if (codegenProperty != null) {
|
} else if (codegenProperty != null) {
|
||||||
LOGGER.warn("The following schema has undefined (null) baseType. " +
|
if (StringUtils.isEmpty(bodyParameterName)) {
|
||||||
"It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. " +
|
codegenParameter.baseName = codegenModel.classname;
|
||||||
"A correct 'consumes' for form parameters should be " +
|
} else {
|
||||||
"'application/x-www-form-urlencoded' or 'multipart/form-data'");
|
codegenParameter.baseName = bodyParameterName;
|
||||||
LOGGER.warn("schema: " + schema);
|
}
|
||||||
LOGGER.warn("Defaulting baseType to UNKNOWN_BASE_TYPE");
|
codegenParameter.paramName = toParamName(codegenParameter.baseName);
|
||||||
codegenProperty.baseType = "UNKNOWN_BASE_TYPE";
|
codegenParameter.baseType = codegenModel.classname;
|
||||||
|
codegenParameter.dataType = getTypeDeclaration(codegenModel.classname);
|
||||||
codegenParameter.baseName = codegenProperty.baseType;
|
codegenParameter.description = codegenModel.description;
|
||||||
codegenParameter.baseType = codegenProperty.baseType;
|
imports.add(codegenParameter.baseType);
|
||||||
codegenParameter.dataType = codegenProperty.dataType;
|
|
||||||
codegenParameter.description = codegenProperty.description;
|
|
||||||
codegenParameter.paramName = toParamName(codegenProperty.baseType);
|
|
||||||
|
|
||||||
if (codegenProperty.complexType != null) {
|
if (codegenProperty.complexType != null) {
|
||||||
imports.add(codegenProperty.complexType);
|
imports.add(codegenProperty.complexType);
|
||||||
|
@ -81,7 +81,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
apiTemplateFiles.put("api.mustache", ".rb");
|
apiTemplateFiles.put("api.mustache", ".rb");
|
||||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||||
embeddedTemplateDir = templateDir = "ruby";
|
embeddedTemplateDir = templateDir = "ruby-client";
|
||||||
|
|
||||||
modelTestTemplateFiles.put("model_test.mustache", ".rb");
|
modelTestTemplateFiles.put("model_test.mustache", ".rb");
|
||||||
apiTestTemplateFiles.put("api_test.mustache", ".rb");
|
apiTestTemplateFiles.put("api_test.mustache", ".rb");
|
||||||
|
@ -85,7 +85,7 @@ public class RubyOnRailsServerCodegen extends DefaultCodegen implements CodegenC
|
|||||||
modelPackage = "app/models";
|
modelPackage = "app/models";
|
||||||
modelTemplateFiles.put("model.mustache", ".rb");
|
modelTemplateFiles.put("model.mustache", ".rb");
|
||||||
|
|
||||||
embeddedTemplateDir = templateDir = "rails5";
|
embeddedTemplateDir = templateDir = "ruby-on-rails-server";
|
||||||
|
|
||||||
typeMapping.clear();
|
typeMapping.clear();
|
||||||
languageSpecificPrimitives.clear();
|
languageSpecificPrimitives.clear();
|
||||||
|
@ -56,7 +56,7 @@ public class RubySinatraServerCodegen extends DefaultCodegen implements CodegenC
|
|||||||
// no model
|
// no model
|
||||||
modelTemplateFiles.clear();
|
modelTemplateFiles.clear();
|
||||||
apiTemplateFiles.put("api.mustache", ".rb");
|
apiTemplateFiles.put("api.mustache", ".rb");
|
||||||
embeddedTemplateDir = templateDir = "sinatra";
|
embeddedTemplateDir = templateDir = "ruby-sinatra-server";
|
||||||
|
|
||||||
typeMapping.clear();
|
typeMapping.clear();
|
||||||
languageSpecificPrimitives.clear();
|
languageSpecificPrimitives.clear();
|
||||||
|
@ -576,7 +576,9 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
allParams.add(p);
|
allParams.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allParams.get(allParams.size()-1).hasMore =false;
|
if (!allParams.isEmpty()) {
|
||||||
|
allParams.get(allParams.size()-1).hasMore =false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,9 +135,21 @@ public class URLPathUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String sanitizeUrl(String url) {
|
private static String sanitizeUrl(String url) {
|
||||||
if (url.startsWith("/")) {
|
if (url.startsWith("//")) {
|
||||||
LOGGER.warn("'host' not defined in the spec (2.0). Default to " + LOCAL_HOST);
|
url = "http:" + url;
|
||||||
|
LOGGER.warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
|
||||||
|
} else if (url.startsWith("/")) {
|
||||||
url = LOCAL_HOST + url;
|
url = LOCAL_HOST + url;
|
||||||
|
LOGGER.warn("'host' not defined in the spec (2.0). Default to [{}] for server URL [{}]", LOCAL_HOST, url);
|
||||||
|
} else if (!url.matches("[a-zA-Z][0-9a-zA-Z.+\\-]+://.+")) {
|
||||||
|
// Add http scheme for urls without a scheme.
|
||||||
|
// 2.0 spec is restricted to the following schemes: "http", "https", "ws", "wss"
|
||||||
|
// 3.0 spec does not have an enumerated list of schemes
|
||||||
|
// This regex attempts to capture all schemes in IANA example schemes which
|
||||||
|
// can have alpha-numeric characters and [.+-]. Examples are here:
|
||||||
|
// https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
|
||||||
|
url = "http://" + url;
|
||||||
|
LOGGER.warn("'scheme' not defined in the spec (2.0). Default to [http] for server URL [{}]", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
@ -206,8 +206,8 @@
|
|||||||
{{#useBeanValidation}}
|
{{#useBeanValidation}}
|
||||||
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
<beanvalidation-version>1.1.0.Final</beanvalidation-version>
|
||||||
{{/useBeanValidation}}
|
{{/useBeanValidation}}
|
||||||
<cxf-version>3.2.1</cxf-version>
|
<cxf-version>3.2.5</cxf-version>
|
||||||
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
|
<jackson-jaxrs-version>2.9.6</jackson-jaxrs-version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -263,8 +263,8 @@
|
|||||||
{{#generateSpringBootApplication}}
|
{{#generateSpringBootApplication}}
|
||||||
<spring.boot-version>1.5.9.RELEASE</spring.boot-version>
|
<spring.boot-version>1.5.9.RELEASE</spring.boot-version>
|
||||||
{{/generateSpringBootApplication}}
|
{{/generateSpringBootApplication}}
|
||||||
<cxf-version>3.2.1</cxf-version>
|
<cxf-version>3.2.5</cxf-version>
|
||||||
<jackson-jaxrs-version>2.9.1</jackson-jaxrs-version>
|
<jackson-jaxrs-version>2.9.6</jackson-jaxrs-version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -67,9 +67,10 @@ type {{{nickname}}}Opts struct {
|
|||||||
func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) {
|
func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) {
|
||||||
var (
|
var (
|
||||||
localVarHttpMethod = strings.ToUpper("{{httpMethod}}")
|
localVarHttpMethod = strings.ToUpper("{{httpMethod}}")
|
||||||
localVarPostBody interface{}
|
localVarPostBody interface{}
|
||||||
localVarFileName string
|
localVarFormFileName string
|
||||||
localVarFileBytes []byte
|
localVarFileName string
|
||||||
|
localVarFileBytes []byte
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
localVarReturnValue {{{returnType}}}
|
localVarReturnValue {{{returnType}}}
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
@ -177,6 +178,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{#isFile}}
|
{{#isFile}}
|
||||||
|
localVarFormFileName = "{{baseName}}"
|
||||||
{{#required}}
|
{{#required}}
|
||||||
localVarFile := {{paramName}}
|
localVarFile := {{paramName}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
@ -254,7 +256,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
|||||||
|
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
|
return {{#returnType}}localVarReturnValue, {{/returnType}}nil, err
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,8 @@ func parameterToString(obj interface{}, collectionFormat string) string {
|
|||||||
|
|
||||||
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
if reflect.TypeOf(obj).Kind() == reflect.Slice {
|
||||||
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
|
||||||
|
} else if t, ok := obj.(time.Time); ok {
|
||||||
|
return t.Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%v", obj)
|
return fmt.Sprintf("%v", obj)
|
||||||
@ -165,6 +167,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
queryParams url.Values,
|
queryParams url.Values,
|
||||||
formParams url.Values,
|
formParams url.Values,
|
||||||
|
formFileName string,
|
||||||
fileName string,
|
fileName string,
|
||||||
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
fileBytes []byte) (localVarRequest *http.Request, err error) {
|
||||||
|
|
||||||
@ -207,7 +210,7 @@ func (c *APIClient) prepareRequest(
|
|||||||
if len(fileBytes) > 0 && fileName != "" {
|
if len(fileBytes) > 0 && fileName != "" {
|
||||||
w.Boundary()
|
w.Boundary()
|
||||||
//_, fileNm := filepath.Split(fileName)
|
//_, fileNm := filepath.Split(fileName)
|
||||||
part, err := w.CreateFormFile("file", filepath.Base(fileName))
|
part, err := w.CreateFormFile(formFileName, filepath.Base(fileName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -427,8 +430,9 @@ func CacheExpires(r *http.Response) time.Time {
|
|||||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
expires = now
|
expires = now
|
||||||
|
} else {
|
||||||
|
expires = now.Add(lifetime)
|
||||||
}
|
}
|
||||||
expires = now.Add(lifetime)
|
|
||||||
} else {
|
} else {
|
||||||
expiresHeader := r.Header.Get("Expires")
|
expiresHeader := r.Header.Get("Expires")
|
||||||
if expiresHeader != "" {
|
if expiresHeader != "" {
|
||||||
|
@ -82,26 +82,27 @@ class {{classname}}(object):
|
|||||||
returns the request thread.
|
returns the request thread.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
local_var_params = locals()
|
||||||
|
|
||||||
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
|
all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
|
||||||
all_params.append('async')
|
all_params.append('async')
|
||||||
all_params.append('_return_http_data_only')
|
all_params.append('_return_http_data_only')
|
||||||
all_params.append('_preload_content')
|
all_params.append('_preload_content')
|
||||||
all_params.append('_request_timeout')
|
all_params.append('_request_timeout')
|
||||||
|
|
||||||
params = locals()
|
for key, val in six.iteritems(local_var_params['kwargs']):
|
||||||
for key, val in six.iteritems(params['kwargs']):
|
|
||||||
if key not in all_params:
|
if key not in all_params:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"Got an unexpected keyword argument '%s'"
|
"Got an unexpected keyword argument '%s'"
|
||||||
" to method {{operationId}}" % key
|
" to method {{operationId}}" % key
|
||||||
)
|
)
|
||||||
params[key] = val
|
local_var_params[key] = val
|
||||||
del params['kwargs']
|
del local_var_params['kwargs']
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
# verify the required parameter '{{paramName}}' is set
|
# verify the required parameter '{{paramName}}' is set
|
||||||
if ('{{paramName}}' not in params or
|
if ('{{paramName}}' not in local_var_params or
|
||||||
params['{{paramName}}'] is None):
|
local_var_params['{{paramName}}'] is None):
|
||||||
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501
|
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
@ -109,35 +110,35 @@ class {{classname}}(object):
|
|||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{#hasValidation}}
|
{{#hasValidation}}
|
||||||
{{#maxLength}}
|
{{#maxLength}}
|
||||||
if ('{{paramName}}' in params and
|
if ('{{paramName}}' in local_var_params and
|
||||||
len(params['{{paramName}}']) > {{maxLength}}):
|
len(local_var_params['{{paramName}}']) > {{maxLength}}):
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be less than or equal to `{{maxLength}}`") # noqa: E501
|
||||||
{{/maxLength}}
|
{{/maxLength}}
|
||||||
{{#minLength}}
|
{{#minLength}}
|
||||||
if ('{{paramName}}' in params and
|
if ('{{paramName}}' in local_var_params and
|
||||||
len(params['{{paramName}}']) < {{minLength}}):
|
len(local_var_params['{{paramName}}']) < {{minLength}}):
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, length must be greater than or equal to `{{minLength}}`") # noqa: E501
|
||||||
{{/minLength}}
|
{{/minLength}}
|
||||||
{{#maximum}}
|
{{#maximum}}
|
||||||
if '{{paramName}}' in params and params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
|
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}: # noqa: E501
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value less than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}`{{maximum}}`") # noqa: E501
|
||||||
{{/maximum}}
|
{{/maximum}}
|
||||||
{{#minimum}}
|
{{#minimum}}
|
||||||
if '{{paramName}}' in params and params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
|
if '{{paramName}}' in local_var_params and local_var_params['{{paramName}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}: # noqa: E501
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must be a value greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}`{{minimum}}`") # noqa: E501
|
||||||
{{/minimum}}
|
{{/minimum}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
if '{{paramName}}' in params and not re.search('{{{vendorExtensions.x-regex}}}', params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
|
if '{{paramName}}' in local_var_params and not re.search('{{{vendorExtensions.x-regex}}}', local_var_params['{{paramName}}']{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, must conform to the pattern `{{{pattern}}}`") # noqa: E501
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{#maxItems}}
|
{{#maxItems}}
|
||||||
if ('{{paramName}}' in params and
|
if ('{{paramName}}' in local_var_params and
|
||||||
len(params['{{paramName}}']) > {{maxItems}}):
|
len(local_var_params['{{paramName}}']) > {{maxItems}}):
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be less than or equal to `{{maxItems}}`") # noqa: E501
|
||||||
{{/maxItems}}
|
{{/maxItems}}
|
||||||
{{#minItems}}
|
{{#minItems}}
|
||||||
if ('{{paramName}}' in params and
|
if ('{{paramName}}' in local_var_params and
|
||||||
len(params['{{paramName}}']) < {{minItems}}):
|
len(local_var_params['{{paramName}}']) < {{minItems}}):
|
||||||
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
|
raise ValueError("Invalid value for parameter `{{paramName}}` when calling `{{operationId}}`, number of items must be greater than or equal to `{{minItems}}`") # noqa: E501
|
||||||
{{/minItems}}
|
{{/minItems}}
|
||||||
{{/hasValidation}}
|
{{/hasValidation}}
|
||||||
@ -148,37 +149,37 @@ class {{classname}}(object):
|
|||||||
|
|
||||||
path_params = {}
|
path_params = {}
|
||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
if '{{paramName}}' in params:
|
if '{{paramName}}' in local_var_params:
|
||||||
path_params['{{baseName}}'] = params['{{paramName}}']{{#isListContainer}} # noqa: E501
|
path_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501
|
||||||
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
|
|
||||||
query_params = []
|
query_params = []
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
if '{{paramName}}' in params:
|
if '{{paramName}}' in local_var_params:
|
||||||
query_params.append(('{{baseName}}', params['{{paramName}}'])){{#isListContainer}} # noqa: E501
|
query_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{#isListContainer}} # noqa: E501
|
||||||
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
|
|
||||||
header_params = {}
|
header_params = {}
|
||||||
{{#headerParams}}
|
{{#headerParams}}
|
||||||
if '{{paramName}}' in params:
|
if '{{paramName}}' in local_var_params:
|
||||||
header_params['{{baseName}}'] = params['{{paramName}}']{{#isListContainer}} # noqa: E501
|
header_params['{{baseName}}'] = local_var_params['{{paramName}}']{{#isListContainer}} # noqa: E501
|
||||||
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
form_params = []
|
form_params = []
|
||||||
local_var_files = {}
|
local_var_files = {}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
if '{{paramName}}' in params:
|
if '{{paramName}}' in local_var_params:
|
||||||
{{^isFile}}form_params.append(('{{baseName}}', params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501
|
{{^isFile}}form_params.append(('{{baseName}}', local_var_params['{{paramName}}'])){{/isFile}}{{#isFile}}local_var_files['{{baseName}}'] = local_var_params['{{paramName}}']{{/isFile}}{{#isListContainer}} # noqa: E501
|
||||||
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
collection_formats['{{baseName}}'] = '{{collectionFormat}}'{{/isListContainer}} # noqa: E501
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
|
|
||||||
body_params = None
|
body_params = None
|
||||||
{{#bodyParam}}
|
{{#bodyParam}}
|
||||||
if '{{paramName}}' in params:
|
if '{{paramName}}' in local_var_params:
|
||||||
body_params = params['{{paramName}}']
|
body_params = local_var_params['{{paramName}}']
|
||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
{{#hasProduces}}
|
{{#hasProduces}}
|
||||||
# HTTP header `Accept`
|
# HTTP header `Accept`
|
||||||
@ -205,10 +206,10 @@ class {{classname}}(object):
|
|||||||
files=local_var_files,
|
files=local_var_files,
|
||||||
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501
|
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501
|
||||||
auth_settings=auth_settings,
|
auth_settings=auth_settings,
|
||||||
async=params.get('async'),
|
async=local_var_params.get('async'),
|
||||||
_return_http_data_only=params.get('_return_http_data_only'),
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
||||||
_preload_content=params.get('_preload_content', True),
|
_preload_content=local_var_params.get('_preload_content', True),
|
||||||
_request_timeout=params.get('_request_timeout'),
|
_request_timeout=local_var_params.get('_request_timeout'),
|
||||||
collection_formats=collection_formats)
|
collection_formats=collection_formats)
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -125,17 +125,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.logger_file_handler.setFormatter(self.logger_formatter)
|
self.logger_file_handler.setFormatter(self.logger_formatter)
|
||||||
for _, logger in six.iteritems(self.logger):
|
for _, logger in six.iteritems(self.logger):
|
||||||
logger.addHandler(self.logger_file_handler)
|
logger.addHandler(self.logger_file_handler)
|
||||||
if self.logger_stream_handler:
|
|
||||||
logger.removeHandler(self.logger_stream_handler)
|
|
||||||
else:
|
|
||||||
# If not set logging file,
|
|
||||||
# then add stream handler and remove file handler.
|
|
||||||
self.logger_stream_handler = logging.StreamHandler()
|
|
||||||
self.logger_stream_handler.setFormatter(self.logger_formatter)
|
|
||||||
for _, logger in six.iteritems(self.logger):
|
|
||||||
logger.addHandler(self.logger_stream_handler)
|
|
||||||
if self.logger_file_handler:
|
|
||||||
logger.removeHandler(self.logger_file_handler)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def debug(self):
|
def debug(self):
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user