{ "openapi": "3.0.1", "info": { "title": "Rust Blog Backend API", "description": "API collection for testing the Rust Blog Backend", "version": "1.0.0" }, "tags": [], "paths": { "/api/auth/register": { "post": { "summary": "Register - Short Password", "deprecated": false, "description": "Test validation: password too short (min 8 chars)", "tags": [], "parameters": [ { "name": "Content-Type", "in": "header", "description": "", "required": true, "example": "application/json", "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "required": [ "email", "password" ] }, "example": { "email": "test2@example.com", "password": "short" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } }, "/api/auth/login": { "post": { "summary": "Login - Wrong Password", "deprecated": false, "description": "Test: wrong password returns 401", "tags": [], "parameters": [ { "name": "Content-Type", "in": "header", "description": "", "required": true, "example": "application/json", "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } }, "required": [ "email", "password" ] }, "example": { "email": "test@example.com", "password": "wrongpassword" } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } }, "/api/posts": { "post": { "summary": "Create Post - Empty Title", "deprecated": false, "description": "Test validation: empty title returns 400", "tags": [], "parameters": [ { "name": "Content-Type", "in": "header", "description": "", "required": true, "example": "application/json", "schema": { "type": "string" } }, { "name": "Authorization", "in": "header", "description": "", "required": true, "example": "Bearer {{token}}", "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "title": { "type": "string" }, "content": { "type": "string" }, "published": { "type": "boolean" } }, "required": [ "title", "content", "published" ] }, "example": { "title": "", "content": "Content without title", "published": true } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] }, "get": { "summary": "List Posts (Page 2)", "deprecated": false, "description": "List posts - second page with 5 items per page.", "tags": [], "parameters": [ { "name": "page", "in": "query", "description": "", "required": true, "example": "2", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "description": "", "required": true, "example": "5", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } }, "/api/posts/post_id": { "get": { "summary": "Get Post by ID", "deprecated": false, "description": "Get a single post by ID. No authentication required.", "tags": [], "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] }, "put": { "summary": "Update Post (Publish)", "deprecated": false, "description": "Publish a draft post. Only updates the published field.", "tags": [], "parameters": [ { "name": "Content-Type", "in": "header", "description": "", "required": true, "example": "application/json", "schema": { "type": "string" } }, { "name": "Authorization", "in": "header", "description": "", "required": true, "example": "Bearer {{token}}", "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "published": { "type": "boolean" } }, "required": [ "published" ] }, "example": { "published": true } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] }, "delete": { "summary": "Delete Post", "deprecated": false, "description": "Soft delete a post. Requires authentication and ownership.", "tags": [], "parameters": [ { "name": "Authorization", "in": "header", "description": "", "required": true, "example": "Bearer {{token}}", "schema": { "type": "string" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } }, "/api/upload": { "post": { "summary": "Upload Image", "deprecated": false, "description": "Upload an image file. Requires authentication. Allowed types: jpg, jpeg, png, webp. Max size: 5MB.", "tags": [], "parameters": [ { "name": "Authorization", "in": "header", "description": "", "required": true, "example": "Bearer {{token}}", "schema": { "type": "string" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "description": "Select a JPG, JPEG, PNG, or WebP image (max 5MB)", "type": "string", "format": "binary" } }, "required": [ "file" ] } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } }, "/api/posts/non-existent-id": { "get": { "summary": "Get Post - Not Found", "deprecated": false, "description": "Test: getting non-existent post returns 404", "tags": [], "parameters": [], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": {} } } } } }, "security": [] } } }, "components": { "schemas": {}, "responses": {}, "securitySchemes": {} }, "servers": [ { "url": "http://127.0.0.1:8765", "description": "测试环境" } ], "security": [] }