Skip to content

Commit 8d41b7b

Browse files
author
Netter, Joshua (319E-Affiliate)
committed
Ran ./bin/python-petstore.sh and ./bin/security/python-petstore.sh shell scripts.
1 parent 843c638 commit 8d41b7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+371
-64
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public PythonClientCodegen() {
7777
languageSpecificPrimitives.add("date");
7878
languageSpecificPrimitives.add("object");
7979

80-
instantiationTypes.put("array", "list");
8180
instantiationTypes.put("map", "dict");
8281

8382
typeMapping.clear();
@@ -358,7 +357,7 @@ public String toInstantiationType(Property p) {
358357
if (p instanceof MapProperty) {
359358
return instantiationTypes.get("map");
360359
}
361-
return super.toInstantiationType(p);
360+
return null;
362361
}
363362

364363
@Override
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.4.0-SNAPSHOT

samples/client/petstore-security-test/python/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ import time
5050
import petstore_api
5151
from petstore_api.rest import ApiException
5252
from pprint import pprint
53+
5354
# create an instance of the API class
54-
api_instance = petstore_api.FakeApi()
55+
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
5556
test_code_inject____end____rn_n_r = 'test_code_inject____end____rn_n_r_example' # str | To test code injection */ ' \" =end -- \\r\\n \\n \\r (optional)
5657

5758
try:

samples/client/petstore-security-test/python/git_push.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ git_remote=`git remote`
3636
if [ "$git_remote" = "" ]; then # git remote not defined
3737

3838
if [ "$GIT_TOKEN" = "" ]; then
39-
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
39+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
4040
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
4141
else
4242
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

samples/client/petstore-security-test/python/petstore_api/api_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ def __deserialize_model(self, data, klass):
614614

615615
instance = klass(**kwargs)
616616

617+
if (isinstance(instance, dict) and
618+
klass.swagger_types is not None and
619+
isinstance(data, dict)):
620+
for key, value in data.items():
621+
if key not in klass.swagger_types:
622+
instance[key] = value
617623
if hasattr(instance, 'get_real_child_model'):
618624
klass_name = instance.get_real_child_model(data)
619625
if klass_name:

samples/client/petstore-security-test/python/petstore_api/models/model_return.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def to_dict(self):
9191
))
9292
else:
9393
result[attr] = value
94+
if issubclass(ModelReturn, dict):
95+
for key, value in self.items():
96+
result[key] = value
9497

9598
return result
9699

samples/client/petstore-security-test/python/tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ envlist = py27, py3
44
[testenv]
55
deps=-r{toxinidir}/requirements.txt
66
-r{toxinidir}/test-requirements.txt
7-
7+
88
commands=
99
nosetests \
10-
[]
10+
[]

samples/client/petstore/python/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ import time
5050
import petstore_api
5151
from petstore_api.rest import ApiException
5252
from pprint import pprint
53+
5354
# create an instance of the API class
54-
api_instance = petstore_api.AnotherFakeApi()
55+
api_instance = petstore_api.AnotherFakeApi(petstore_api.ApiClient(configuration))
5556
body = petstore_api.Client() # Client | client model
5657

5758
try:
@@ -74,6 +75,7 @@ Class | Method | HTTP request | Description
7475
*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
7576
*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
7677
*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
78+
*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
7779
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
7880
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
7981
*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters

samples/client/petstore/python/docs/EnumTest.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**enum_string** | **str** | | [optional]
7+
**enum_string_required** | **str** | |
78
**enum_integer** | **int** | | [optional]
89
**enum_number** | **float** | | [optional]
910
**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional]

samples/client/petstore/python/docs/FakeApi.md

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Method | HTTP request | Description
88
[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |
99
[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |
1010
[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |
11+
[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
1112
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
1213
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
1314
[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
@@ -203,6 +204,52 @@ No authorization required
203204

204205
[[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)
205206

207+
# **test_body_with_query_params**
208+
> test_body_with_query_params(body, query)
209+
210+
211+
212+
### Example
213+
```python
214+
from __future__ import print_function
215+
import time
216+
import petstore_api
217+
from petstore_api.rest import ApiException
218+
from pprint import pprint
219+
220+
# create an instance of the API class
221+
api_instance = petstore_api.FakeApi()
222+
body = petstore_api.User() # User |
223+
query = 'query_example' # str |
224+
225+
try:
226+
api_instance.test_body_with_query_params(body, query)
227+
except ApiException as e:
228+
print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
229+
```
230+
231+
### Parameters
232+
233+
Name | Type | Description | Notes
234+
------------- | ------------- | ------------- | -------------
235+
**body** | [**User**](User.md)| |
236+
**query** | **str**| |
237+
238+
### Return type
239+
240+
void (empty response body)
241+
242+
### Authorization
243+
244+
No authorization required
245+
246+
### HTTP request headers
247+
248+
- **Content-Type**: application/json
249+
- **Accept**: Not defined
250+
251+
[[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)
252+
206253
# **test_client_model**
207254
> Client test_client_model(body)
208255
@@ -252,7 +299,7 @@ No authorization required
252299
[[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)
253300

254301
# **test_endpoint_parameters**
255-
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
302+
> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, _float=_float, string=string, binary=binary, _date=_date, date_time=date_time, password=password, param_callback=param_callback)
256303
257304
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
258305

@@ -280,17 +327,17 @@ byte = 'B' # str | None
280327
integer = 56 # int | None (optional)
281328
int32 = 56 # int | None (optional)
282329
int64 = 789 # int | None (optional)
283-
float = 3.4 # float | None (optional)
330+
_float = 3.4 # float | None (optional)
284331
string = 'string_example' # str | None (optional)
285332
binary = 'B' # str | None (optional)
286-
date = '2013-10-20' # date | None (optional)
333+
_date = '2013-10-20' # date | None (optional)
287334
date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
288335
password = 'password_example' # str | None (optional)
289336
param_callback = 'param_callback_example' # str | None (optional)
290337

291338
try:
292339
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
293-
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
340+
api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, _float=_float, string=string, binary=binary, _date=_date, date_time=date_time, password=password, param_callback=param_callback)
294341
except ApiException as e:
295342
print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
296343
```
@@ -306,10 +353,10 @@ Name | Type | Description | Notes
306353
**integer** | **int**| None | [optional]
307354
**int32** | **int**| None | [optional]
308355
**int64** | **int**| None | [optional]
309-
**float** | **float**| None | [optional]
356+
**_float** | **float**| None | [optional]
310357
**string** | **str**| None | [optional]
311358
**binary** | **str**| None | [optional]
312-
**date** | **date**| None | [optional]
359+
**_date** | **date**| None | [optional]
313360
**date_time** | **datetime**| None | [optional]
314361
**password** | **str**| None | [optional]
315362
**param_callback** | **str**| None | [optional]

0 commit comments

Comments
 (0)