Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5bc9540
Adds additionalproperties feature in python
spacether Feb 4, 2019
64d5444
Adds ensure-up-to-date updates
spacether Feb 4, 2019
ec73f56
Adds docstring description of the model argument inputs
spacether Feb 4, 2019
5cdfe51
Adds ensure up to date oepnapi3 python updates
spacether Feb 4, 2019
0a52027
Adds test fix
spacether Feb 4, 2019
8be21b0
Adds fix for Shippable, gives the additionalProperties CodegenParamet…
spacether Feb 4, 2019
ba7ea49
Adds function to set freeform types to string of all types
spacether Feb 7, 2019
88f8197
Adds postProcessAllModels function which processes and fixes dataType…
spacether Feb 7, 2019
0590d05
Adds models with additionalproperties of each type and model tests
spacether Feb 9, 2019
372ae60
Adds _check_type parameter to model, adds additionalproperties tests
spacether Feb 11, 2019
5b4f108
Creates utils module, adds additionalproperties map for serialization
spacether Feb 12, 2019
2e33cf1
Removes additional_properties_map, creates model_to_dict function to …
spacether Feb 13, 2019
983f570
Improves docstring for model_to_dict
spacether Feb 14, 2019
f218ed5
Adds class type definition in models
spacether Feb 17, 2019
7656756
Adds datetime and date type classes, adds general OpenApiException, r…
spacether Feb 18, 2019
7ac9285
Adds class imports to models, python generator uses dataType for docs…
spacether Feb 20, 2019
67dbb9c
Model discriminator now stores classes, adds __deserialize_model in a…
spacether Feb 22, 2019
9680dfd
Creates exceptions module, all deserialization tests in py2 except 1 …
spacether Feb 23, 2019
05fe1aa
Adds validate_and_convert_types, python 2.0 tests pass except for tes…
spacether Feb 25, 2019
e8f97fa
Adds anytype deserialization tests in python swagger client
spacether Feb 28, 2019
59b2d4c
Fixes typos
spacether Feb 28, 2019
e158601
Adds file deserialization test
spacether Mar 2, 2019
7d84ef2
Updates all v2 and v3 python samples
spacether Mar 3, 2019
b2446cf
Removes dubug flag, reverts readme, in python generator tweaks suppor…
spacether Mar 3, 2019
9e9b94e
Adds dict instantiationType back in
spacether Mar 3, 2019
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
Next Next commit
Fixes typos
  • Loading branch information
spacether committed Mar 2, 2019
commit 59b2d4cb7a9b9f15498b7ca2ec6fc53b0b05e8f2
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
{{>partial_header}}
from __future__ import absolute_import

from collections import OrderedDict
import copy
import inspect
import json
import mimetypes
from multiprocessing.pool import ThreadPool
Expand Down Expand Up @@ -62,7 +60,11 @@ class ApiClient(object):
to the API. More threads means more concurrent API requests.
"""

PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
# six.binary_type python2=str, python3=bytes
# six.text_type python2=unicode, python3=str
PRIMITIVE_TYPES = (
(float, bool, six.binary_type, six.text_type) + six.integer_types
)
_pool = None

def __init__(self, configuration=None, header_name=None, header_value=None,
Expand Down Expand Up @@ -263,8 +265,8 @@ class ApiClient(object):
# this path is used if we are deserializing string data
received_data = response.data

# start our path as 'received_data' so users have some context
# if they are deserializing a string and the data type is wrong
# store our data under the key of 'received_data' so users have some
# context if they are deserializing a string and the data type is wrong
deserialized_data = validate_and_convert_types(
received_data,
response_types_mixed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def get_simple_class(input_value):
# isinstance(True, int) == True
return bool
elif isinstance(input_value, int):
# for pytho2 input_value==float_instance -> return int
# for python2 input_value==long_instance -> return int
# where int is the python3 int backport
return int
elif isinstance(input_value, datetime):
# this must be higher than the int check because
# this must be higher than the date check because
# isinstance(datetime_instance, date) == True
return datetime
elif isinstance(input_value, date):
Expand Down Expand Up @@ -412,7 +412,8 @@ def attempt_convert_item(input_value, valid_classes, path_to_item,
path_to_item, configuration)
elif valid_class == file_type:
return deserialize_file(input_value, configuration)
return deserialize_primitive(input_value,valid_class, path_to_item)
return deserialize_primitive(input_value, valid_class,
path_to_item)
except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc:
if must_convert:
raise conversion_exc
Expand Down Expand Up @@ -450,8 +451,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item,
results = get_required_type_classes(required_types_mixed)
valid_classes, child_req_types_by_current_type = results

imput_class_simple = get_simple_class(input_value)
valid_type = imput_class_simple in set(valid_classes)
input_class_simple = get_simple_class(input_value)
valid_type = input_class_simple in set(valid_classes)
if not valid_type:
if configuration:
# if input_value is not valid_type try to convert it
Expand Down