You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs have stated for some time that flask-restx should be compatible with Marshmallow. I'm trying to use marshmallow's field.UUID field that flask-restx keeps interpreting as a string, but couldn't get the api schema to work.
I've gone back to a smaller example to showcase the issue:
127.0.0.1 - - [10/Dec/2021 15:52:08] "GET / HTTP/1.1" 200 -
Unable to render schema
Traceback (most recent call last):
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/api.py", line 565, in __schema__
self._schema = Swagger(self).as_dict()
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 239, in as_dict
serialized = self.serialize_resource(
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 446, in serialize_resource
path[method] = self.serialize_operation(doc, method)
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 452, in serialize_operation
"responses": self.responses_for(doc, method) or None,
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 572, in responses_for
schema = self.serialize_schema(model)
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 633, in serialize_schema
"items": self.serialize_schema(model),
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 653, in serialize_schema
raise ValueError("Model {0} not registered".format(model))
ValueError: Model <class 'app.todo'> not registered
127.0.0.1 - - [10/Dec/2021 15:52:40] "GET / HTTP/1.1" 200 -
Unable to render schema
Traceback (most recent call last):
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/api.py", line 565, in __schema__
self._schema = Swagger(self).as_dict()
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 239, in as_dict
serialized = self.serialize_resource(
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 446, in serialize_resource
path[method] = self.serialize_operation(doc, method)
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 452, in serialize_operation
"responses": self.responses_for(doc, method) or None,
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 572, in responses_for
schema = self.serialize_schema(model)
File "/Users/gv4/PycharmProjects/pipeline_api/venv/lib/python3.8/site-packages/flask_restx/swagger.py", line 653, in serialize_schema
raise ValueError("Model {0} not registered".format(model))
ValueError: Model <TODO(many=False)> not registered
Expected Behavior
Marshmallow Schemas to be accepted alongside flask-restx models
Actual Behavior
flask-restx throws a Model not registered error.
Error Messages/Stack Trace
If applicable, add the stack trace produced by the error
Environment
Python 3.8.2
Flask 1.1.4
Werkzeug 1.0.1
Flask-RESTX 0.4.0
Additional Context
This is your last chance to provide any pertinent details, don't let this opportunity pass you by!
The text was updated successfully, but these errors were encountered:
The whole request parser part of Flask-RESTX is slated for removal and will be replaced by documentation on how to integrate with other packages that do the input/output stuff better (such as marshmallow).
Key being will be replaced. At this time, the request parser does not integrate.
Furthermore you can see an open ticket for possible API model redesign: #59
At this time, flask-restx only supports it's own models for API and the built in request parser.
Hi @j5awry, thanks for getting back to me so quickly. Do you have any suggestions on how I can use Flask-Restx to take in a UUID in my requests parser?
The docs have stated for some time that flask-restx should be compatible with Marshmallow. I'm trying to use marshmallow's
field.UUID
field that flask-restx keeps interpreting as a string, but couldn't get the api schema to work.I've gone back to a smaller example to showcase the issue:
Code
Using the Quickstart from the README
throws the following error:
or
Throws the following error:
Expected Behavior
Marshmallow Schemas to be accepted alongside flask-restx models
Actual Behavior
flask-restx throws a Model not registered error.
Error Messages/Stack Trace
If applicable, add the stack trace produced by the error
Environment
Additional Context
This is your last chance to provide any pertinent details, don't let this opportunity pass you by!
The text was updated successfully, but these errors were encountered: