Update enums schema from OpenAPI 2.0 to OpenAPI 3.0
darrenchang opened this issue · 2 comments
darrenchang commented
- The property method
Argument.__schema__
creates the wrong OpenAPI 3.0 schema for enums.
https://github.com/darrenchang/flask-restx/blob/master/flask_restx/reqparse.py - OpenAPI 3.0 enums doc https://swagger.io/docs/specification/data-models/enums/
Expected Behavior
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"collectionFormat": "csv",
"in": "formData",
"items": {
"enum": [
"item1",
"item2",
"item3",
],
"type": "string"
},
"name": "picked_items",
"type": "array"
},
Actual Behavior
"parameters": [
{
"in": "formData",
"name": "file",
"required": true,
"type": "file"
},
{
"collectionFormat": "csv",
"enum": [
"item1",
"item2",
"item3",
],
"in": "formData",
"items": {
"type": "string"
},
"name": "picked_items",
"type": "array"
},
Environment
- Python==3.10.11
- Flask==2.2.2
- Flask-RESTX==1.2.0
peter-doggart commented
Flask-restx generates Swagger 2.0 (https://swagger.io/specification/v2/) compliant docs only. Unfortunately, OpenAPI 3.0 support has been on the ask list for a long time but because of the way schemas are generated it's not a small change.
darrenchang commented
Flask-restx generates Swagger 2.0 (https://swagger.io/specification/v2/) compliant docs only. Unfortunately, OpenAPI 3.0 support has been on the ask list for a long time but because of the way schemas are generated it's not a small change.
I see. Thank you for the replying to this issue