Questions tagged [flask-smorest]

10 questions
2
votes
1 answer

Deserialize list of ids for many-to-many PUT operation

I have a User and Role model with a many-to-many relationship class User(BaseModel, TimestampableMixin): username = Column(String(MEDIUM_STRING_LENGTH), nullable=False, unique=True) roles = relationship('Role', secondary='user_roles',…
1
vote
0 answers

Adding flask-security-too routes to OpenAPI documentation generated by flask-smorest

To set up OpenAPI with flask-smorest, you need to import Api from flask_smorest, and pass Api the flask_app object. Then you use method register_blueprint to register blueprints, and that's it. from flask_smorest import Api api =…
Dev_Ian_T
  • 11
  • 3
1
vote
1 answer

Using a custom parser with flask_smorest and/or marshmallow

I'm using flask-smorest, the Flask/Marshmallow-based REST API framework and would like to be able to parse requests made with the axios JavaScript library, specifically for arrays passed via the querystring. Axios sends arrays like…
Mathieu Dhondt
  • 8,405
  • 5
  • 37
  • 58
0
votes
1 answer

url_for function not working in flask application

This is my app.py: from flask import Flask from flask_smorest import Api from db import db from routes import blp as RoutesBlueprint def create_app(): app = Flask(__name__) app.config["API_TITLE"] = "URL Shortner" …
0
votes
0 answers

How best can I apply flask_http_middleware with flask application factory that actually works flawlessly?

This is my factory function, where I've tried setting up flask_http_middleware as per the documentation. I'm using flask smorest and trying to implement addition of JWT based authentication middleware fastapi way in flask. I've been getting a…
Bigtymer
  • 121
  • 10
0
votes
1 answer

Flask-smorest returning an empty json string

The JSON response of my endpoint returns {} even though I am logging the correct data. from flask_smorest import Blueprint bp = Blueprint("auth", __name__, url_prefix="/api/v1/auth/") @bp.route("/login",…
spitfiredd
  • 2,897
  • 5
  • 32
  • 75
0
votes
1 answer

Error on docker ValueError: The name 'Items' is already registered for this blueprint. Use 'name=' to provide a unique name

I am currently building an API on VS Code using Python 3.11, Flask, Insomnia, and Docker. when I tried to create my resources file to use flask_smorest I am getting this error on Docker ValueError: The name 'Items' is already registered for this…
Val Kuikman
  • 61
  • 1
  • 7
0
votes
1 answer

flask-smorest response and return type different

I am learning/working on a Rest Api suing flask-smorest and adding the schema using marshmallow. Below is the code that I am confused with and have a question. Schemas.py class ChildAddressDetailsSchema(Schema): class Meta: unknown =…
0
votes
1 answer

How to use a list of arguments with flask_smorest/marshmallow

I am trying to insert a collection of objects in a flask api. We use marshmallow for deserializing. My endpoint looks like this: @blp.arguments(SomeSchemas, location='json', as_kwargs=True) @blp.response(200, SomeSchemas) def…
Oskar
  • 90
  • 1
  • 10
-1
votes
0 answers

Is it possible to integrate `Flask-Smorest` and `Flask-Caching` for the purpose of caching requests?

I'd like to integrate both frameworks in my webapp. Flask-Smorest is used to define a RESTful API while Flask-Caching allows me to cache requests and specify duration and validity of the cache (whereas Flask-Smorest ETag doesn't seem to cover…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187