Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rename option to recursionLimit
  • Loading branch information
wing328 committed Sep 24, 2020
commit d84cdc50619e7284eb7c9ddc4d28ac0e3b143f06
2 changes: 1 addition & 1 deletion bin/configs/python-experimental.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/python-experimental/
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
setRecursionLimit: "1234"
recursionLimit: "1234"
2 changes: 1 addition & 1 deletion docs/generators/python-experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sidebar_label: python-experimental
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|setRecursionLimit|Set recursion limit. If not set, use the system default value.| |null|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|useNose|use the nose test framework| |false|

## IMPORT MAPPING
Expand Down
2 changes: 1 addition & 1 deletion docs/generators/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sidebar_label: python
|packageUrl|python package URL.| |null|
|packageVersion|python package version.| |1.0.0|
|projectName|python project name in setup.py (e.g. petstore-api).| |null|
|setRecursionLimit|Set recursion limit. If not set, use the system default value.| |null|
|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|useNose|use the nose test framework| |false|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String DEFAULT_LIBRARY = "urllib3";
// nose is a python testing framework, we use pytest if USE_NOSE is unset
public static final String USE_NOSE = "useNose";
public static final String SET_RECURSION_LIMIT = "setRecursionLimit";
public static final String RECURSION_LIMIT = "recursionLimit";

protected String packageName = "openapi_client";
protected String packageVersion = "1.0.0";
Expand Down Expand Up @@ -185,7 +185,7 @@ public PythonClientCodegen() {
.defaultValue(Boolean.FALSE.toString()));
cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework").
defaultValue(Boolean.FALSE.toString()));
cliOptions.add(new CliOption(SET_RECURSION_LIMIT, "Set recursion limit. If not set, use the system default value."));
cliOptions.add(new CliOption(RECURSION_LIMIT, "Set the recursion limit. If not set, use the system default value."));

supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)");
Expand Down Expand Up @@ -256,11 +256,11 @@ public void processOpts() {
}

// check to see if setRecursionLimit is set and whether it's an integer
if (additionalProperties.containsKey(SET_RECURSION_LIMIT)) {
if (additionalProperties.containsKey(RECURSION_LIMIT)) {
try {
Integer.parseInt((String)additionalProperties.get(SET_RECURSION_LIMIT));
Integer.parseInt((String)additionalProperties.get(RECURSION_LIMIT));
} catch(NumberFormatException | NullPointerException e) {
throw new IllegalArgumentException("setRecursionLimit must be an integer, e.g. 2000.");
throw new IllegalArgumentException("recursionLimit must be an integer, e.g. 2000.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ from {{packageName}}.exceptions import ApiException
# import models into sdk package
{{#models}}{{#model}}from {{modelPackage}}.{{classFilename}} import {{classname}}
{{/model}}{{/models}}
{{#setRecursionLimit}}
{{#recursionLimit}}

__import__('sys').setrecursionlimit({{{.}}})
{{/setRecursionLimit}}
{{/recursionLimit}}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from {{packageName}}.exceptions import ApiTypeError
from {{packageName}}.exceptions import ApiValueError
from {{packageName}}.exceptions import ApiKeyError
from {{packageName}}.exceptions import ApiException
{{#setRecursionLimit}}
{{#recursionLimit}}

__import__('sys').setrecursionlimit({{{.}}})
{{/setRecursionLimit}}
{{/recursionLimit}}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String PACKAGE_URL_VALUE = "";
public static final String USE_NOSE_VALUE = "false";
public static final String SET_RECURSION_LIMIT = "1200";
public static final String RECURSION_LIMIT = "1200";

@Override
public String getLanguage() {
Expand All @@ -48,7 +48,7 @@ public Map<String, String> createOptions() {
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3")
.put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE)
.put(PythonClientCodegen.SET_RECURSION_LIMIT, SET_RECURSION_LIMIT)
.put(PythonClientCodegen.RECURSION_LIMIT, RECURSION_LIMIT)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def test_boolean(self):
assert endpoint.openapi_types['body'] == (bool,)
assert endpoint.settings['response_type'] == (bool,)

def test_setrecursionlimit(self):
"""Test case for setrecursionlimit
def test_recursionlimit(self):
"""Test case for recursionlimit

"""
assert sys.getrecursionlimit() == 1234
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def setUp(self):
def tearDown(self):
pass

def test_setrecursionlimit(self):
"""Test case for setrecursionlimit
def test_recursionlimit(self):
"""Test case for recursionlimit

"""
assert sys.getrecursionlimit() == 1234
Expand Down