flask-restx
flask-restx copied to clipboard
Update reqparse.py so that pattern is properly set on list objects wh…
…en using option "append"
Using the reqparse option "append" in combination with a "pattern" leads to the wrong validation schema. Example, using the following code:
obj.add_argument('tag', location='args', type=inputs.regex('^[-_a-zA-Z0-9]+$') , action='append', default='', help='Filters obj tagged with the provided tags')
Currently result with the following schema:
{
name: "tag",
in: "query",
type: "array",
description: "Filters domains tagged with the provided tags",
pattern: "^[-_a-zA-Z0-9]+$"
default: "",
items:
{
type: "string",
},
collectionFormat: "multi"
}
Which should be:
{
name: "tag",
in: "query",
type: "array",
description: "Filters domains tagged with the provided tags",
default: "",
items:
{
type: "string",
pattern: "^[-_a-zA-Z0-9]+$"
},
collectionFormat: "multi"
}
Kind regards
I include this in patch for reqparser
here in my restx-monkey in 0.2.1+ version.
I have fixed your patch and applied it on the main branch. Thanks again for your contribution.
Thanks for fixing it and accepting the change.