-
-
Notifications
You must be signed in to change notification settings - Fork 140
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I'm not sure if this is an issue with my usage, or something with apiflask, but I'm having trouble getting the generated api docs to reflect return of a list instead of a single element. The examples on the apiflask pages don't seem to cover this case.
class UserOut(Schema):
id = Integer()
name = String()
email = String()
age = Integer()
status = String()
@api_blueprint.route("/latest/TestList")
@api_blueprint.output(UserOut(many=True))
@api_blueprint.doc(summary="List all users", description="Get a list of all registered users")
def api_testlist():
users = [
{"id": 1, "username": "nneul", "name": "user name", "status": "active"}
]
return users
I would expect this to return something that indicated an array return, but it is resulting in this in the openapi spec:
"UserOut": {
"additionalProperties": false,
"properties": {
"age": {
"type": "integer"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"status": {
"type": "string"
}
},
"type": "object"
}
"/api-bin/latest/TestList": {
"get": {
"description": "Get a list of all registered users",
"parameters": [],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserOut"
}
}
},
"description": "Successful response"
}
},
"summary": "List all users",
"tags": [
"Unauthenticated API Endpoints"
]
}
},
Environment:
- Python version: 3.11
- Flask version: 3.1.2
- APIFlask version: 3.0.2
Am I missing something obvious here?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working