Primitives

class pyswagger.primitives.Byte[source]

for string type, byte format

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

apply_with(_, v, ctx)[source]

constructor

Parameters:v (str) – accept six.string_types, six.binary_type
to_json()[source]

according to https://github.com/wordnik/swagger-spec/issues/50, we should exchange ‘byte’ type via base64 encoding.

class pyswagger.primitives.Date[source]

for string type, date format

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

apply_with(_, v, ctx)[source]

constructor

Parameters:v (timestamp in float, datetime.date object, or ISO-8601 in str) – things used to constrcut date
class pyswagger.primitives.Datetime[source]

for string type, datetime format

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

apply_with(_, v, ctx)[source]

constructor

Parameters:v (timestamp in float, datetime.datetime object, or ISO-8601 in str) – things used to constrcut date
class pyswagger.primitives.Array[source]

for array type, or parameter when allowMultiple=True

__init__()[source]

v: list or string_types

__str__()[source]

array primitives should be for ‘path’, ‘header’, ‘query’. Therefore, this kind of convertion is reasonable.

Returns:the converted string
Return type:str
apply_with(obj, val, ctx)[source]
to_url()[source]

special function for handling ‘multi’, refer to Swagger 2.0, Parameter Object, collectionFormat

class pyswagger.primitives.Model[source]

for complex type: models

__init__()[source]

constructor

__eq__(other)[source]

equality operater, will skip checking when both value are None or no attribute.

Parameters:other (primitives.Model or dict) – another model
__ne__(other)[source]
apply_with(obj, val, ctx)[source]

recursivly apply Schema object

Parameters:
  • obj (obj.Model) – model object to instruct how to create this model
  • val (dict) – things used to construct this model
cleanup(val, ctx)[source]