Skip to content

Commit

Permalink
Add python-experimental-openapiv3-sample (#4992)
Browse files Browse the repository at this point in the history
Add python-experimental-openapiv3-sample

Add missing files for the Python samples

Add python-experimental-petstore.bat for openapi v3

Add python-experimental samples openapi v3

Add python-experimental samples openapi v3

Add python-experimental samples openapi v3. Address review comments

add missing files for test purpose

fix python formatting issues

fix python formatting issues

fix python formatting issues

Fix unit tests

fix python formatting issues

fix python formatting issues

fix python formatting issues

fix 'line too long' pep8 error

address PR comments for pep8 'line too long' problem

regenerate samples

execute samples scripts

dummy commit to retrigger circleci

Revert dummy commit, it didn't help.
  • Loading branch information
sebastien-rosset authored and wing328 committed Jan 21, 2020
1 parent 95bd32d commit 63859d6
Show file tree
Hide file tree
Showing 226 changed files with 22,417 additions and 214 deletions.
32 changes: 32 additions & 0 deletions bin/openapi3/python-experimental-petstore.sh
Original file line number Diff line number Diff line change
@@ -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} -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/openapi3/client/petstore/python-experimental/ --additional-properties packageName=petstore_api $@"

java $JAVA_OPTS -jar $executable $ags
10 changes: 10 additions & 0 deletions bin/openapi3/windows/python-experimental-petstore.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar

If Not Exist %executable% (
mvn clean package
)

REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples\openapi3\client\petstore\python-experimental --additional-properties packageName=petstore_api

java %JAVA_OPTS% -jar %executable% %ags%
1 change: 1 addition & 0 deletions bin/utils/ensure-up-to-date
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ declare -a samples=(
"${root}/bin/python-petstore-all.sh"
"${root}/bin/python-server-all.sh"
"${root}/bin/openapi3/python-petstore.sh"
"${root}/bin/openapi3/python-experimental-petstore.sh"
"${root}/bin/php-petstore.sh"
"${root}/bin/php-silex-petstore-server.sh"
"${root}/bin/php-symfony-petstore.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ private String robustImport(String name) {
// name looks like cat.Cat
String moduleName = name.split("\\.")[0];
// https://exceptionshub.com/circular-or-cyclic-imports-in-python.html
String modelImport = "try:\n from " + modelPackage() + " import "+ moduleName+ "\nexcept ImportError:\n "+moduleName+" = sys.modules['"+modelPackage() + "."+ moduleName+"']";
String modelImport = "try:\n from " + modelPackage() +
" import " + moduleName+ "\nexcept ImportError:\n " +
moduleName + " = sys.modules[\n '" + modelPackage() + "." + moduleName + "']";
return modelImport;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class {{classname}}(object):
)
kwargs['_host_index'] = kwargs.get('_host_index', 0)
{{#requiredParams}}
kwargs['{{paramName}}'] = {{paramName}}
kwargs['{{paramName}}'] = \
{{paramName}}
{{/requiredParams}}
return self.call_with_http_info(**kwargs)

Expand Down Expand Up @@ -216,7 +217,8 @@ class {{classname}}(object):
},
'openapi_types': {
{{#allParams}}
'{{paramName}}': ({{{dataType}}},),
'{{paramName}}':
({{{dataType}}},),
{{/allParams}}
},
'attribute_map': {
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@
<module>samples/client/petstore/python-asyncio</module>
<module>samples/client/petstore/python-tornado</module>
<module>samples/openapi3/client/petstore/python</module>
<module>samples/openapi3/client/petstore/python-experimental</module>
<module>samples/client/petstore/typescript-fetch/builds/default</module>
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def __call_123_test_special_tags(self, body, **kwargs): # noqa: E501
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index', 0)
kwargs['body'] = body
kwargs['body'] = \
body
return self.call_with_http_info(**kwargs)

self.call_123_test_special_tags = Endpoint(
Expand Down Expand Up @@ -134,7 +135,8 @@ def __call_123_test_special_tags(self, body, **kwargs): # noqa: E501
'allowed_values': {
},
'openapi_types': {
'body': (client.Client,),
'body':
(client.Client,),
},
'attribute_map': {
},
Expand Down
Loading

0 comments on commit 63859d6

Please sign in to comment.