Move local generic body class to public GenericRequestParam
Move the local generic body class that is private to the Router class
and rename it to GenericRequestParam and make it public so that the
class can be used when calling specific API handler explicitly.
@@ -145,6 +145,11 @@ class NotFoundException(Exception):
pass
+class GenericRequestParam(object):
+ def __init__(self, **entries):
+ self.__dict__.update(entries)
+
+
class Request(webob.Request):
"""
Custom Request implementation which uses our custom and faster json serializer and deserializer.
@@ -518,11 +523,6 @@ class Router(object):
if content_type == "text/plain":
kw[argument_name] = data
else:
-
- class Body(object):
- def __init__(self, **entries):
- self.__dict__.update(entries)
-
ref = schema.get("$ref", None)
if ref:
with self.spec_resolver.resolving(ref) as resolved:
@@ -553,10 +553,10 @@ class Router(object):
)
else:
LOG.debug(
- "Missing x-api-model definition for %s, using generic Body "
+ "Missing x-api-model definition for %s, using GenericRequestParam "
"model." % (endpoint["operationId"])
)
- model = Body
+ model = GenericRequestParam
instance = self._get_model_instance(model_cls=model, data=data)
kw[argument_name] = instance
