Questions tagged [flask-restplus]

Flask-RESTPlus is an extension for Flask that adds support for quickly building REST APIs documented with Swagger

Flask-RestPlus provide syntaxic suger, helpers and automatically generated Swagger documentation on top of Flask-Restful. It provides a bunch of decorators and helpers to quickly build documented and maintainable APIs with Flask.

Website: https://flask-restplus.readthedocs.io/

334 questions
4
votes
0 answers

Does Flask RESTPlus support the Open API response examples property?

Given a Flask RESTPlus model like: todo = api.model("Todo", { "id": fields.Integer(example=123), "task": fields.String(example="Feed the cat") }) I want Flask RESTPlus support the Open API response examples property, to export a spec…
LaSmell
  • 151
  • 8
4
votes
2 answers

How do I POST multiple files using Flask-RESTPlus?

I want to be able to POST an array of files. I got it working with a single file, but it doesn't work when adding action="append" to the parser. When adding action, the swagger UI allows me to upload multiple files, but when printing the files…
Joey
  • 41
  • 2
4
votes
0 answers

Use existing sql-alchemy model class as flask-restplus api.model?

I am developing a CRUD application using vue.js and vuetify as frontend (view) and python flask-resplus and sqlAlchemy as backend (controler and model). app/main/model/person.py from sqlalchemy import Column, Integer, String, Date from…
wuz
  • 391
  • 1
  • 13
4
votes
1 answer

How to protect swagger documentation with password

I am building a flask app and need to add password for swagger documentation in production, but dont know how. Here is my code: api = Api( version='1.0', title='API', description='Main API', doc='/doc', …
4
votes
1 answer

How to define dictionary fields with flask_restplus to be used in go code generated with swagger codegen?

I have used swagger CLI to generate go code to call my flask app. swagger codegen converts fields.Raw type defined with flask_restplus model to *interface{} in go assigning the value to the field with *interface{} type in go returns…
Azadeh Khojandi
  • 3,110
  • 24
  • 31
4
votes
2 answers

Flask Marshmallow JSON fields

I have defined a POST call would that needs data: { "one" : "hello", "two" : "world", "three" : { "abc": "123", "def": false } } For this, I am able to define one and two, but unsure what…
rgamber
  • 5,231
  • 8
  • 48
  • 92
4
votes
1 answer

how to hide password with ********* on swagger ui with flask_restplus in python

Hi Below is my running code , can be accessed with below URL: http://127.0.0.1:5000/api/documentation from flask import Flask, Blueprint from flask_restplus import Api, Resource, fields app = Flask(__name__) blueprint = Blueprint('api', __name__,…
4
votes
1 answer

Flask-restplus returning marshal model instead of the data

So I'm pretty new to implementing flask-restplus and I have encountered this road block. I have read the restplus docs over and over again and followed several exampled. But the behavior that I'm facing is very much different from what is supposed…
hrishikeshpaul
  • 397
  • 7
  • 19
4
votes
2 answers

How to generate a machine readable yaml specification of an existing API written in flask-restplus?

I have a simple API written with the help of flask-restplus: from flask import Flask from flask_restplus import Resource, Api app = Flask(__name__) # Create a Flask WSGI application api = Api(app) # Create…
Riko
  • 95
  • 2
  • 9
4
votes
1 answer

Flask-restplus: any way to sort the namespaces in swagger?

Is there any way to sort the Namespace entries after they've been added to the Api? I'm following the documentation, and the flow (AFAIK) appears to be: a) Create the API: api = Api(version="1.0", title="MahApi", description="Mah Nice…
Ojingo
  • 172
  • 1
  • 8
4
votes
1 answer

Validate custom field with Flask-RESTPlus

I'm trying to create a custom field for validating POSTed JSON in my API using Flask-RESTPlus 0.10.1 Below is the basic setup... from flask_restplus import fields import re EMAIL_REGEX = re.compile(r'\S+@\S+\.\S+') class Email(fields.String): …
aesterisk
  • 219
  • 4
  • 14
4
votes
1 answer

How to display schema example with flask_restplus?

[Using Python, Flask, flask_restplus, Swagger] I'm trying to display a schema model as the picture below using flask_restplus. Prototype schema in yml and not python: I created the schema_model but I'm not sure how to input it into the code so that…
zeusking123
  • 139
  • 8
4
votes
1 answer

flask restplus path variable default value

How to set the default value for a path variable with Flask restplus? For example, with the below: @api.route('/calendars/coordinates///years/') class DailyCalendarHandler(Resource): get_parser =…
vishvAs vAsuki
  • 1,503
  • 2
  • 12
  • 17
4
votes
1 answer

Take JSONAPI schema from model

In my Rest application I want to return json like JSONAPI format, but I need to create Schema class for it and create every field again that are already there in my model. So instead of creating every field in schema class can I not take it from DB…
Sanjay
  • 1,456
  • 2
  • 12
  • 22
4
votes
1 answer

Flask-restplus: how to define a nested model with 'allOf' operation?

Creating a python flask rest plus server application, I'm trying to create a model for input body (in POST operation) with 'allOf' operator, which is equivalent to the following example, taken from swagger.yaml I've created with the swagger…
Amir
  • 181
  • 2
  • 8
1 2
3
22 23