flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

On fields if `pattern` parameter is added swagger execute request button when clicked has no effect

Open ClimenteA opened this issue 3 years ago • 0 comments

Here is the minimum code required to replay the error:


from flask import Flask, request
from flask_restx import Resource, Api, fields

app = Flask(__name__)
api = Api(app)


simple_email_model = api.model("email_model", dict(
    email=fields.String(required=True, pattern=".+@.+")
))


@api.route('/email')
class TestEmail(Resource):

    @api.expect(simple_email_model, validate=True)
    def post(self):
        return request.json



if __name__ == '__main__':
    app.run(debug=True)

I expect if pattern doesn't match the validation should fail.

But, when I go to swagger-ui, complete the field and click on Execute button - nothing happens (the request is not made, button is freezed).

Environment

  • Python version - 3.8
  • Flask version - 2.0.3
  • Flask-RESTX version - 0.5.1

ClimenteA avatar Feb 24 '22 07:02 ClimenteA