Fix escaped regex values in Python client (#1517). (#1539)

* Fix escaped regex values in Python client (#1517).

* Override PythonClientCodegen toRegularExpression() method to correct
  issue with backslashes being escaped. This issue was a result of
  calling escapeText() in the parent DefaultCodegen class.

* Only escape unescaped forward slashes in PythonClientCodegen.

* Override addRegularExpressionDelimiter in PythonClientCodegen.java
  such that only unescaped forward slashes in the pattern get escaped.
* Adds a new test resource .yaml file for specifically testing this
  issue.

* Check for regular expression modifiers in PythonClientCodegen.

* Adds check in postProcessPattern() in PythonClientCodegen.java to
  check if regular expression has modifiers defined. If so, it throws an
  exception as modifiers are not currently supported in the Python
  client.

* PythonClientCodegen warns that regex modifiers are not supported.

* Changes behavior in PythonClientCodegen.java to no longer throw an
  IllegalArgumentException in the case that a pattern contains
  modifiers. A warning message will be logged instead stating that
  modifiers are not currently supported by the codegen class.

* Remove warning for PythonClientCodegen regex modifier support.

* Removes warning message from PythonClientCodegen.java stating that
  regular expression modifiers are not currently supported. Further
  code review and testing revealed that this feature is already
  supported and working.

* Add updated Python client sample files.
This commit is contained in:
John Bush
2018-12-07 22:32:55 -05:00
committed by William Cheng
parent 2d39f14882
commit c4f0521e10
25 changed files with 343 additions and 149 deletions

View File

@@ -488,7 +488,7 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_group_parameters**
> test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
Fake endpoint to test group parameters (optional)
@@ -504,13 +504,16 @@ from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi()
required_string_group = 56 # int | Required String in group parameters
required_boolean_group = True # bool | Required Boolean in group parameters
required_int64_group = 56 # int | Required Integer in group parameters
string_group = 56 # int | String in group parameters (optional)
boolean_group = True # bool | Boolean in group parameters (optional)
int64_group = 56 # int | Integer in group parameters (optional)
try:
# Fake endpoint to test group parameters (optional)
api_instance.test_group_parameters(string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
except ApiException as e:
print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
```
@@ -519,6 +522,9 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**required_string_group** | **int**| Required String in group parameters |
**required_boolean_group** | **bool**| Required Boolean in group parameters |
**required_int64_group** | **int**| Required Integer in group parameters |
**string_group** | **int**| String in group parameters | [optional]
**boolean_group** | **bool**| Boolean in group parameters | [optional]
**int64_group** | **int**| Integer in group parameters | [optional]