connexion.decorators.uri_parsing

This module defines view function decorators to split query and path parameters.

Module Contents

Classes

AbstractURIParser

a URI parser is initialized with parameter definitions.

OpenAPIURIParser

a URI parser is initialized with parameter definitions.

Swagger2URIParser

Adheres to the Swagger2 spec,

FirstValueURIParser

Adheres to the Swagger2 spec

AlwaysMultiURIParser

Does not adhere to the Swagger2 spec, but is backwards compatible with

Attributes

logger

QUERY_STRING_DELIMITERS

connexion.decorators.uri_parsing.logger
connexion.decorators.uri_parsing.QUERY_STRING_DELIMITERS
class connexion.decorators.uri_parsing.AbstractURIParser(param_defns, body_defn)

Bases: connexion.decorators.decorator.BaseDecorator

a URI parser is initialized with parameter definitions. When called with a request object, it handles array types in the URI both in the path and query according to the spec. Some examples include: - https://mysite.fake/in/path/1,2,3/ # path parameters - https://mysite.fake/?in_query=a,b,c # simple query params - https://mysite.fake/?in_query=a|b|c # various separators - https://mysite.fake/?in_query=a&in_query=b,c # complex query params

parsable_parameters = ['query', 'path']
property param_defns(self)

returns the parameter definitions by name

property param_schemas(self)

returns the parameter schemas by name

__repr__(self)
Return type:

str

abstract resolve_form(self, form_data)

Resolve cases where form parameters are provided multiple times.

abstract resolve_query(self, query_data)

Resolve cases where query parameters are provided multiple times.

abstract resolve_path(self, path)

Resolve cases where path parameters include lists

resolve_params(self, params, _in)

takes a dict of parameters, and resolves the values into the correct array type handling duplicate values, and splitting based on the collectionFormat defined in the spec.

__call__(self, function)
Return type:

types.FunctionType

class connexion.decorators.uri_parsing.OpenAPIURIParser(param_defns, body_defn)

Bases: AbstractURIParser

a URI parser is initialized with parameter definitions. When called with a request object, it handles array types in the URI both in the path and query according to the spec. Some examples include: - https://mysite.fake/in/path/1,2,3/ # path parameters - https://mysite.fake/?in_query=a,b,c # simple query params - https://mysite.fake/?in_query=a|b|c # various separators - https://mysite.fake/?in_query=a&in_query=b,c # complex query params

style_defaults
parsable_parameters = ['query', 'path']
property param_defns(self)

returns the parameter definitions by name

property form_defns(self)
property param_schemas(self)

returns the parameter schemas by name

resolve_form(self, form_data)

Resolve cases where form parameters are provided multiple times.

resolve_query(self, query_data)

Resolve cases where query parameters are provided multiple times.

resolve_path(self, path_data)

Resolve cases where path parameters include lists

__repr__(self)
Return type:

str

resolve_params(self, params, _in)

takes a dict of parameters, and resolves the values into the correct array type handling duplicate values, and splitting based on the collectionFormat defined in the spec.

__call__(self, function)
Return type:

types.FunctionType

class connexion.decorators.uri_parsing.Swagger2URIParser(param_defns, body_defn)

Bases: AbstractURIParser

Adheres to the Swagger2 spec, Assumes the the last defined query parameter should be used.

a URI parser is initialized with parameter definitions. When called with a request object, it handles array types in the URI both in the path and query according to the spec. Some examples include: - https://mysite.fake/in/path/1,2,3/ # path parameters - https://mysite.fake/?in_query=a,b,c # simple query params - https://mysite.fake/?in_query=a|b|c # various separators - https://mysite.fake/?in_query=a&in_query=b,c # complex query params

parsable_parameters = ['query', 'path', 'formData']
property param_defns(self)

returns the parameter definitions by name

property param_schemas(self)

returns the parameter schemas by name

resolve_form(self, form_data)

Resolve cases where form parameters are provided multiple times.

resolve_query(self, query_data)

Resolve cases where query parameters are provided multiple times.

resolve_path(self, path_data)

Resolve cases where path parameters include lists

__repr__(self)
Return type:

str

resolve_params(self, params, _in)

takes a dict of parameters, and resolves the values into the correct array type handling duplicate values, and splitting based on the collectionFormat defined in the spec.

__call__(self, function)
Return type:

types.FunctionType

class connexion.decorators.uri_parsing.FirstValueURIParser(param_defns, body_defn)

Bases: Swagger2URIParser

Adheres to the Swagger2 spec Assumes that the first defined query parameter should be used

a URI parser is initialized with parameter definitions. When called with a request object, it handles array types in the URI both in the path and query according to the spec. Some examples include: - https://mysite.fake/in/path/1,2,3/ # path parameters - https://mysite.fake/?in_query=a,b,c # simple query params - https://mysite.fake/?in_query=a|b|c # various separators - https://mysite.fake/?in_query=a&in_query=b,c # complex query params

parsable_parameters = ['query', 'path', 'formData']
property param_defns(self)

returns the parameter definitions by name

property param_schemas(self)

returns the parameter schemas by name

resolve_form(self, form_data)

Resolve cases where form parameters are provided multiple times.

resolve_query(self, query_data)

Resolve cases where query parameters are provided multiple times.

resolve_path(self, path_data)

Resolve cases where path parameters include lists

__repr__(self)
Return type:

str

resolve_params(self, params, _in)

takes a dict of parameters, and resolves the values into the correct array type handling duplicate values, and splitting based on the collectionFormat defined in the spec.

__call__(self, function)
Return type:

types.FunctionType

class connexion.decorators.uri_parsing.AlwaysMultiURIParser(param_defns, body_defn)

Bases: Swagger2URIParser

Does not adhere to the Swagger2 spec, but is backwards compatible with connexion behavior in version 1.4.2

a URI parser is initialized with parameter definitions. When called with a request object, it handles array types in the URI both in the path and query according to the spec. Some examples include: - https://mysite.fake/in/path/1,2,3/ # path parameters - https://mysite.fake/?in_query=a,b,c # simple query params - https://mysite.fake/?in_query=a|b|c # various separators - https://mysite.fake/?in_query=a&in_query=b,c # complex query params

parsable_parameters = ['query', 'path', 'formData']
property param_defns(self)

returns the parameter definitions by name

property param_schemas(self)

returns the parameter schemas by name

resolve_form(self, form_data)

Resolve cases where form parameters are provided multiple times.

resolve_query(self, query_data)

Resolve cases where query parameters are provided multiple times.

resolve_path(self, path_data)

Resolve cases where path parameters include lists

__repr__(self)
Return type:

str

resolve_params(self, params, _in)

takes a dict of parameters, and resolves the values into the correct array type handling duplicate values, and splitting based on the collectionFormat defined in the spec.

__call__(self, function)
Return type:

types.FunctionType