connexion.resolver
¶
This module contains resolvers, functions that resolves the user defined view functions from the operations defined in the OpenAPI spec.
Module Contents¶
Classes¶
Represents the result of operation resolution |
|
Standard resolver |
|
Resolves endpoint functions relative to a given root path or module. |
|
Resolves endpoint functions using REST semantics (unless overridden by specifying operationId) |
|
Resolves endpoint functions based on Flask's MethodView semantics, e.g. |
Attributes¶
- connexion.resolver.logger¶
- class connexion.resolver.Resolution(function, operation_id)¶
Represents the result of operation resolution
- Parameters:
function (types.FunctionType) – The endpoint function
- class connexion.resolver.Resolver(function_resolver=utils.get_function_from_name)¶
Standard resolver
- Parameters:
function_resolver (types.FunctionType) – Function that resolves functions using an operationId
- resolve(self, operation)¶
Default operation resolver
- resolve_operation_id(self, operation)¶
Default operationId resolver
- resolve_function_from_operation_id(self, operation_id)¶
Invokes the function_resolver
- class connexion.resolver.RelativeResolver(root_path, function_resolver=utils.get_function_from_name)¶
Bases:
Resolver
Resolves endpoint functions relative to a given root path or module.
- Parameters:
root_path (Union[str, types.ModuleType]) – The root path relative to which an operationId is resolved. Can also be a module. Has the same effect as setting x-swagger-router-controller or x-openapi-router-controller equal to root_path for every operation individually.
function_resolver (types.FunctionType) – Function that resolves functions using an operationId
- resolve_operation_id(self, operation)¶
Resolves the operationId relative to the root path, unless x-swagger-router-controller or x-openapi-router-controller is specified.
- Parameters:
operation (connexion.operations.AbstractOperation) – The operation to resolve
- resolve(self, operation)¶
Default operation resolver
- resolve_function_from_operation_id(self, operation_id)¶
Invokes the function_resolver
- class connexion.resolver.RestyResolver(default_module_name, collection_endpoint_name='search')¶
Bases:
Resolver
Resolves endpoint functions using REST semantics (unless overridden by specifying operationId)
- Parameters:
default_module_name (str) – Default module name for operations
- resolve_operation_id(self, operation)¶
Resolves the operationId using REST semantics unless explicitly configured in the spec
- resolve_operation_id_using_rest_semantics(self, operation)¶
Resolves the operationId using REST semantics
- resolve(self, operation)¶
Default operation resolver
- resolve_function_from_operation_id(self, operation_id)¶
Invokes the function_resolver
- class connexion.resolver.MethodViewResolver(*args, **kwargs)¶
Bases:
RestyResolver
Resolves endpoint functions based on Flask’s MethodView semantics, e.g.
paths: /foo_bar: get: # Implied function call: api.FooBarView().get class FooBarView(MethodView): def get(self): return ... def post(self): return ...
- Parameters:
default_module_name (str) – Default module name for operations
- resolve_operation_id(self, operation)¶
Resolves the operationId using REST semantics unless explicitly configured in the spec Once resolved with REST semantics the view_name is capitalised and has ‘View’ added to it so it now matches the Class names of the MethodView
- resolve_function_from_operation_id(self, operation_id)¶
Invokes the function_resolver
- resolve_operation_id_using_rest_semantics(self, operation)¶
Resolves the operationId using REST semantics
- resolve(self, operation)¶
Default operation resolver