Skip to content

Commit 109808e

Browse files
spacetherwing328
authored andcommitted
[Python] Adds new client generator, python-experimental (#3244)
* Adds python-experimental generator * Adds python-experimental samples folder which uses its own v2 spec * Adds enusre-up-to-date updates * Removes samples/client/petstore/perl/t/AnotherFakeApiTest.t * Removes comment line from python-experimental generator * Reverts perl docs file * Updates perl sample client * Adds python-experimental to pom.xml * Copies the python test foldeers tests and testfiles into python-experimental * Copies python test folder into python-experimental * Moves python testing from Travis (samples pom.xml profile) to Circlci (samples.circleci pom.xml profile) * Adds python-experimental pom.xml * Adds python-experimental makefile and .sh files * Chenges python-experimental to use gitignored venv rather than .venv which is not ignored when testing * Adds dev-requiremnts.txt and removes .travis.yml from python-experimental so CI tests will pass * Moves python-experimental from CicleCI to Travis to get support for multiple python environments * Updates generator java comment so CI tests will run over again
1 parent 78551d0 commit 109808e

199 files changed

Lines changed: 22471 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn -B clean package $@
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30+
ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml -g python-experimental -o samples/client/petstore/python-experimental -DpackageName=petstore_api $@"
31+
32+
java $JAVA_OPTS -jar $executable $ags

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ The following generators are available:
4343
- [php](generators/php.md)
4444
- [powershell](generators/powershell.md)
4545
- [python](generators/python.md)
46+
- [python-experimental](generators/python-experimental.md)
4647
- [r](generators/r.md)
4748
- [ruby](generators/ruby.md)
4849
- [rust](generators/rust.md)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
---
3+
id: generator-opts-client-python-experimental
4+
title: Config Options for python-experimental
5+
sidebar_label: python-experimental
6+
---
7+
8+
| Option | Description | Values | Default |
9+
| ------ | ----------- | ------ | ------- |
10+
|packageName|python package name (convention: snake_case).| |openapi_client|
11+
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
12+
|packageVersion|python package version.| |1.0.0|
13+
|packageUrl|python package URL.| |null|
14+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
15+
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
16+
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
17+
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.openapitools.codegen.languages;
18+
19+
import org.slf4j.Logger;
20+
import org.slf4j.LoggerFactory;
21+
22+
public class PythonClientExperimentalCodegen extends PythonClientCodegen {
23+
private static final Logger LOGGER = LoggerFactory.getLogger(PythonClientExperimentalCodegen.class);
24+
25+
public PythonClientExperimentalCodegen() {
26+
super();
27+
}
28+
29+
/**
30+
* Configures a friendly name for the generator. This will be used by the
31+
* generator to select the library with the -g flag.
32+
*
33+
* @return the friendly name for the generator
34+
*/
35+
@Override
36+
public String getName() {
37+
return "python-experimental";
38+
}
39+
}

modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ org.openapitools.codegen.languages.PhpSymfonyServerCodegen
7474
org.openapitools.codegen.languages.PhpZendExpressivePathHandlerServerCodegen
7575
org.openapitools.codegen.languages.PowerShellClientCodegen
7676
org.openapitools.codegen.languages.PythonClientCodegen
77+
org.openapitools.codegen.languages.PythonClientExperimentalCodegen
7778
org.openapitools.codegen.languages.PythonFlaskConnexionServerCodegen
7879
org.openapitools.codegen.languages.PythonAiohttpConnexionServerCodegen
7980
org.openapitools.codegen.languages.PythonBluePlanetServerCodegen

0 commit comments

Comments
 (0)