fix(api): 限制公开接口分页结果窗口 (#45)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
fu500f
2026-10-31 00:54:37 +00:00
co-authored by Devin AI
parent 36f9c95fa7
commit 124f14b509
5 changed files with 77 additions and 6 deletions
+13 -5
View File
@@ -25,8 +25,8 @@
{ "name": "category", "in": "query", "schema": { "type": "string" }, "description": "Category code (matches the subtree), e.g. food.beverages." },
{ "name": "brand", "in": "query", "schema": { "type": "string" }, "description": "Brand name (fuzzy)." },
{ "name": "country", "in": "query", "schema": { "type": "string" }, "description": "Country of origin (case-insensitive prefix)." },
{ "name": "page", "in": "query", "schema": { "type": "integer", "default": 1, "minimum": 1 } },
{ "name": "size", "in": "query", "schema": { "type": "integer", "default": 20, "maximum": 100 } }
{ "name": "page", "in": "query", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "description": "Page number; page × size must not exceed 10000." },
{ "name": "size", "in": "query", "schema": { "type": "integer", "default": 20, "maximum": 100 }, "description": "Page size; page × size must not exceed 10000." }
],
"responses": {
"200": {
@@ -50,6 +50,7 @@
}
}
},
"400": { "$ref": "#/components/responses/PageTooDeep" },
"401": { "$ref": "#/components/responses/InvalidApiKey" },
"429": { "$ref": "#/components/responses/RateLimited" }
}
@@ -99,10 +100,13 @@
"tags": ["catalog"],
"summary": "List brands",
"parameters": [
{ "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } },
{ "name": "size", "in": "query", "schema": { "type": "integer", "default": 20, "maximum": 100 } }
{ "name": "page", "in": "query", "schema": { "type": "integer", "default": 1, "minimum": 1 }, "description": "Page number; page × size must not exceed 10000." },
{ "name": "size", "in": "query", "schema": { "type": "integer", "default": 20, "maximum": 100 }, "description": "Page size; page × size must not exceed 10000." }
],
"responses": { "200": { "description": "Paged brands" } }
"responses": {
"200": { "description": "Paged brands" },
"400": { "$ref": "#/components/responses/PageTooDeep" }
}
}
},
"/categories": {
@@ -164,6 +168,10 @@
"InvalidApiKey": {
"description": "API key invalid or revoked.",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
},
"PageTooDeep": {
"description": "The requested page exceeds the 10000-result window.",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } }
}
},
"schemas": {