flask-restful-swagger icon indicating copy to clipboard operation
flask-restful-swagger copied to clipboard

[Question] How can I set an example value?

Open reddytocode opened this issue 5 years ago • 2 comments

I'm doing an auth service

my Register endpoint looks like:

class Register(Resource):
    @swagger.operation(
        notes='Register a new User',
        responseClass=SwaggerUserModel.__name__,
        nickname='create',
        parameters=[
            {
                "name": "body",
                "description": "This should send {"name", "password"}",
                "required": True,
                "allowMultiple": False,
                "dataType": SwaggerUserModel.__name__,
                "paramType": "body",
                "exampleValue": fake_auth_register_form
            }
        ])
    def post(self):
        data = parser.parse_args()

when I get the swagger ui it only shows me the body as an empty field, but I want to get a filled value to only press the button of "Try it out!" not having an empty one

reddytocode avatar Jan 23 '20 18:01 reddytocode

I'd like to find out if we aren't meeting the spec here, did you have any luck with this?

niall-byrne avatar Feb 10 '20 16:02 niall-byrne

try replace "exampleValue" to "defaultValue", it works for me.

qtvspa avatar Jun 23 '20 11:06 qtvspa