AI-News/backend/openapi.json
2025-12-04 10:04:21 +08:00

1799 lines
45 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"openapi": "3.0.2",
"info": {
"title": "FastAPI example application",
"version": "0.0.0"
},
"paths": {
"/api/auth/email-code": {
"post": {
"tags": [
"authentication"
],
"summary": "Auth:Email-Code",
"description": "发送邮箱验证码并写入数据库(若仓库存在)。",
"operationId": "auth_email_code_api_auth_email_code_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmailCodeSendIn"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmailCodeSendOut"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/auth/login": {
"post": {
"tags": [
"authentication"
],
"summary": "Auth:Login",
"description": "邮箱 + 密码登录(签发 Access & Set-Cookie Refresh",
"operationId": "auth_login_api_auth_login_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_auth_login_api_auth_login_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/auth": {
"post": {
"tags": [
"authentication"
],
"summary": "Auth:Register",
"description": "注册流程:\n1) 校验两次密码一致\n2) 校验邮箱未被占用\n3) 校验验证码(若存在验证码仓库)\n4) 生成唯一用户名\n5) 创建用户\n6) 如仓库提供 set_email_verified则置为 True\n7) 签发 Access & Set-Cookie Refresh",
"operationId": "auth_register_api_auth_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_auth_register_api_auth_post"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/auth/refresh": {
"post": {
"tags": [
"authentication"
],
"summary": "Auth:Refresh",
"description": "从 HttpOnly Cookie 读取 refresh校验后签发新的 access并重置 refresh Cookie。\n最小改造版本refresh 不轮换(如需轮换/重放检测,请走“增表方案”)。",
"operationId": "auth_refresh_api_auth_refresh_post",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
}
}
}
},
"/api/auth/logout": {
"post": {
"tags": [
"authentication"
],
"summary": "Auth:Logout",
"operationId": "auth_logout_api_auth_logout_post",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
}
}
}
},
"/api/auth/password/forgot": {
"post": {
"tags": [
"auth-password"
],
"summary": "Forgot Password",
"operationId": "forgot_password_api_auth_password_forgot_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PasswordForgotIn"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/auth/password/reset": {
"post": {
"tags": [
"auth-password"
],
"summary": "Reset Password",
"operationId": "reset_password_api_auth_password_reset_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PasswordResetIn"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/user": {
"get": {
"tags": [
"users"
],
"summary": "Users:Get-Current-User",
"operationId": "users_get_current_user_api_user_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInResponse"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
},
"put": {
"tags": [
"users"
],
"summary": "Users:Update-Current-User",
"operationId": "users_update_current_user_api_user_put",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_users_update_current_user_api_user_put"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/profiles/{username}": {
"get": {
"tags": [
"profiles"
],
"summary": "Profiles:Get-Profile",
"operationId": "profiles_get_profile_api_profiles__username__get",
"parameters": [
{
"required": true,
"schema": {
"title": "Username",
"minLength": 1,
"type": "string"
},
"name": "username",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProfileInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/profiles/{username}/follow": {
"post": {
"tags": [
"profiles"
],
"summary": "Profiles:Follow-User",
"operationId": "profiles_follow_user_api_profiles__username__follow_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Username",
"minLength": 1,
"type": "string"
},
"name": "username",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProfileInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
},
"delete": {
"tags": [
"profiles"
],
"summary": "Profiles:Unsubscribe-From-User",
"operationId": "profiles_unsubscribe_from_user_api_profiles__username__follow_delete",
"parameters": [
{
"required": true,
"schema": {
"title": "Username",
"minLength": 1,
"type": "string"
},
"name": "username",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProfileInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles/feed": {
"get": {
"tags": [
"articles"
],
"summary": "Articles:Get-User-Feed-Articles",
"operationId": "articles_get_user_feed_articles_api_articles_feed_get",
"parameters": [
{
"required": false,
"schema": {
"title": "Limit",
"minimum": 1,
"type": "integer",
"default": 20
},
"name": "limit",
"in": "query"
},
{
"required": false,
"schema": {
"title": "Offset",
"minimum": 0,
"type": "integer",
"default": 0
},
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListOfArticlesInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles/{slug}/favorite": {
"post": {
"tags": [
"articles"
],
"summary": "Articles:Mark-Article-Favorite",
"operationId": "articles_mark_article_favorite_api_articles__slug__favorite_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArticleInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
},
"delete": {
"tags": [
"articles"
],
"summary": "Articles:Unmark-Article-Favorite",
"operationId": "articles_unmark_article_favorite_api_articles__slug__favorite_delete",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArticleInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles": {
"get": {
"tags": [
"articles"
],
"summary": "Articles:List-Articles",
"operationId": "articles_list_articles_api_articles_get",
"parameters": [
{
"required": false,
"schema": {
"title": "Tag",
"type": "string"
},
"name": "tag",
"in": "query"
},
{
"required": false,
"schema": {
"title": "Author",
"type": "string"
},
"name": "author",
"in": "query"
},
{
"required": false,
"schema": {
"title": "Favorited",
"type": "string"
},
"name": "favorited",
"in": "query"
},
{
"required": false,
"schema": {
"title": "Limit",
"minimum": 1,
"type": "integer",
"default": 20
},
"name": "limit",
"in": "query"
},
{
"required": false,
"schema": {
"title": "Offset",
"minimum": 0,
"type": "integer",
"default": 0
},
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListOfArticlesInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
},
"post": {
"tags": [
"articles"
],
"summary": "Articles:Create-Article",
"operationId": "articles_create_article_api_articles_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_articles_create_article_api_articles_post"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArticleInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles/{slug}": {
"get": {
"tags": [
"articles"
],
"summary": "Articles:Get-Article",
"description": "文章详情:对所有人开放访问。\n- 未登录 / token 缺失 / token 无效 -\u003E user 为 None正常返回文章。\n- 已登录且 token 有效 -\u003E user 有值,可用于 favorited 等字段计算。",
"operationId": "articles_get_article_api_articles__slug__get",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArticleInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
},
"put": {
"tags": [
"articles"
],
"summary": "Articles:Update-Article",
"operationId": "articles_update_article_api_articles__slug__put",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_articles_update_article_api_articles__slug__put"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ArticleInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
},
"delete": {
"tags": [
"articles"
],
"summary": "Articles:Delete-Article",
"operationId": "articles_delete_article_api_articles__slug__delete",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"204": {
"description": "Successful Response"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles/{slug}/comments": {
"get": {
"tags": [
"comments"
],
"summary": "Comments:Get-Comments-For-Article",
"operationId": "comments_get_comments_for_article_api_articles__slug__comments_get",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListOfCommentsInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
}
]
},
"post": {
"tags": [
"comments"
],
"summary": "Comments:Create-Comment-For-Article",
"operationId": "comments_create_comment_for_article_api_articles__slug__comments_post",
"parameters": [
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_comments_create_comment_for_article_api_articles__slug__comments_post"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommentInResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/articles/{slug}/comments/{comment_id}": {
"delete": {
"tags": [
"comments"
],
"summary": "Comments:Delete-Comment-From-Article",
"operationId": "comments_delete_comment_from_article_api_articles__slug__comments__comment_id__delete",
"parameters": [
{
"required": true,
"schema": {
"title": "Comment Id",
"minimum": 1,
"type": "integer"
},
"name": "comment_id",
"in": "path"
},
{
"required": true,
"schema": {
"title": "Slug",
"minLength": 1,
"type": "string"
},
"name": "slug",
"in": "path"
}
],
"responses": {
"204": {
"description": "Successful Response"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"RWAPIKeyHeader": []
},
{
"RWAPIKeyHeader": []
}
]
}
},
"/api/tags": {
"get": {
"tags": [
"tags"
],
"summary": "Tags:Get-All",
"operationId": "tags_get_all_api_tags_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TagsInList"
}
}
}
}
}
}
},
"/api/upload-image": {
"post": {
"tags": [
"uploads"
],
"summary": "Upload Image",
"operationId": "upload_image_api_upload_image_post",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_upload_image_api_upload_image_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ArticleForResponse": {
"title": "ArticleForResponse",
"required": [
"slug",
"title",
"description",
"body",
"tagList",
"author",
"favorited",
"favoritesCount"
],
"type": "object",
"properties": {
"createdAt": {
"title": "Createdat",
"type": "string",
"format": "date-time"
},
"updatedAt": {
"title": "Updatedat",
"type": "string",
"format": "date-time"
},
"id": {
"title": "Id",
"type": "integer",
"default": 0
},
"slug": {
"title": "Slug",
"type": "string"
},
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"body": {
"title": "Body",
"type": "string"
},
"cover": {
"title": "Cover",
"type": "string"
},
"tagList": {
"title": "Taglist",
"type": "array",
"items": {
"type": "string"
}
},
"author": {
"$ref": "#/components/schemas/Profile"
},
"favorited": {
"title": "Favorited",
"type": "boolean"
},
"favoritesCount": {
"title": "Favoritescount",
"type": "integer"
}
},
"description": "返回给前端的文章结构:\n- 继承 Article包含 cover、tags、author 等)\n- 其中 tags 字段通过 alias 暴露为 tagList兼容现有前端"
},
"ArticleInCreate": {
"title": "ArticleInCreate",
"required": [
"title",
"description",
"body"
],
"type": "object",
"properties": {
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"body": {
"title": "Body",
"type": "string"
},
"tagList": {
"title": "Taglist",
"type": "array",
"items": {
"type": "string"
},
"default": []
},
"cover": {
"title": "Cover",
"type": "string"
}
},
"description": "创建文章时请求体:\n{\n \"article\": {\n \"title\": \"...\",\n \"description\": \"...\",\n \"body\": \"...\",\n \"tagList\": [\"...\"],\n \"cover\": \"可选封面URL\"\n }\n}"
},
"ArticleInResponse": {
"title": "ArticleInResponse",
"required": [
"article"
],
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/ArticleForResponse"
}
}
},
"ArticleInUpdate": {
"title": "ArticleInUpdate",
"type": "object",
"properties": {
"title": {
"title": "Title",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"body": {
"title": "Body",
"type": "string"
},
"cover": {
"title": "Cover",
"type": "string"
}
},
"description": "更新文章时请求体(全部可选):\n- 不传的字段不改\n- cover:\n - 不传:不改\n - 传 null / \"\":清空封面(配合 repo 里 cover_provided 使用)\n - 传字符串:更新为新封面"
},
"Body_articles_create_article_api_articles_post": {
"title": "Body_articles_create_article_api_articles_post",
"required": [
"article"
],
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/ArticleInCreate"
}
}
},
"Body_articles_update_article_api_articles__slug__put": {
"title": "Body_articles_update_article_api_articles__slug__put",
"required": [
"article"
],
"type": "object",
"properties": {
"article": {
"$ref": "#/components/schemas/ArticleInUpdate"
}
}
},
"Body_auth_login_api_auth_login_post": {
"title": "Body_auth_login_api_auth_login_post",
"required": [
"user"
],
"type": "object",
"properties": {
"user": {
"$ref": "#/components/schemas/UserInLogin"
}
}
},
"Body_auth_register_api_auth_post": {
"title": "Body_auth_register_api_auth_post",
"required": [
"user"
],
"type": "object",
"properties": {
"user": {
"$ref": "#/components/schemas/RegisterWithEmailIn"
}
}
},
"Body_comments_create_comment_for_article_api_articles__slug__comments_post": {
"title": "Body_comments_create_comment_for_article_api_articles__slug__comments_post",
"required": [
"comment"
],
"type": "object",
"properties": {
"comment": {
"$ref": "#/components/schemas/CommentInCreate"
}
}
},
"Body_upload_image_api_upload_image_post": {
"title": "Body_upload_image_api_upload_image_post",
"required": [
"file"
],
"type": "object",
"properties": {
"file": {
"title": "File",
"type": "string",
"format": "binary"
}
}
},
"Body_users_update_current_user_api_user_put": {
"title": "Body_users_update_current_user_api_user_put",
"required": [
"user"
],
"type": "object",
"properties": {
"user": {
"$ref": "#/components/schemas/UserInUpdate"
}
}
},
"Comment": {
"title": "Comment",
"required": [
"body",
"author"
],
"type": "object",
"properties": {
"createdAt": {
"title": "Createdat",
"type": "string",
"format": "date-time"
},
"updatedAt": {
"title": "Updatedat",
"type": "string",
"format": "date-time"
},
"id": {
"title": "Id",
"type": "integer",
"default": 0
},
"body": {
"title": "Body",
"type": "string"
},
"author": {
"$ref": "#/components/schemas/Profile"
}
}
},
"CommentInCreate": {
"title": "CommentInCreate",
"required": [
"body"
],
"type": "object",
"properties": {
"body": {
"title": "Body",
"type": "string"
}
}
},
"CommentInResponse": {
"title": "CommentInResponse",
"required": [
"comment"
],
"type": "object",
"properties": {
"comment": {
"$ref": "#/components/schemas/Comment"
}
}
},
"EmailCodeSendIn": {
"title": "EmailCodeSendIn",
"required": [
"email"
],
"type": "object",
"properties": {
"email": {
"title": "Email",
"type": "string",
"format": "email"
},
"scene": {
"allOf": [
{
"$ref": "#/components/schemas/EmailScene"
}
],
"default": "register"
}
}
},
"EmailCodeSendOut": {
"title": "EmailCodeSendOut",
"type": "object",
"properties": {
"ok": {
"title": "Ok",
"type": "boolean",
"default": true
}
}
},
"EmailScene": {
"title": "EmailScene",
"enum": [
"register",
"reset",
"login"
],
"type": "string",
"description": "An enumeration."
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"errors": {
"title": "Errors",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
},
"ListOfArticlesInResponse": {
"title": "ListOfArticlesInResponse",
"required": [
"articles",
"articlesCount"
],
"type": "object",
"properties": {
"articles": {
"title": "Articles",
"type": "array",
"items": {
"$ref": "#/components/schemas/ArticleForResponse"
}
},
"articlesCount": {
"title": "Articlescount",
"type": "integer"
}
}
},
"ListOfCommentsInResponse": {
"title": "ListOfCommentsInResponse",
"required": [
"comments"
],
"type": "object",
"properties": {
"comments": {
"title": "Comments",
"type": "array",
"items": {
"$ref": "#/components/schemas/Comment"
}
}
}
},
"PasswordForgotIn": {
"title": "PasswordForgotIn",
"required": [
"email"
],
"type": "object",
"properties": {
"email": {
"title": "Email",
"type": "string",
"format": "email"
}
}
},
"PasswordResetIn": {
"title": "PasswordResetIn",
"required": [
"email",
"code",
"password",
"confirm_password"
],
"type": "object",
"properties": {
"email": {
"title": "Email",
"type": "string",
"format": "email"
},
"code": {
"title": "Code",
"maxLength": 12,
"minLength": 4,
"type": "string"
},
"password": {
"title": "Password",
"minLength": 6,
"type": "string"
},
"confirm_password": {
"title": "Confirm Password",
"minLength": 6,
"type": "string"
}
}
},
"Profile": {
"title": "Profile",
"required": [
"username"
],
"type": "object",
"properties": {
"username": {
"title": "Username",
"type": "string"
},
"bio": {
"title": "Bio",
"type": "string",
"default": ""
},
"image": {
"title": "Image",
"type": "string"
},
"following": {
"title": "Following",
"type": "boolean",
"default": false
}
}
},
"ProfileInResponse": {
"title": "ProfileInResponse",
"required": [
"profile"
],
"type": "object",
"properties": {
"profile": {
"$ref": "#/components/schemas/Profile"
}
}
},
"RegisterWithEmailIn": {
"title": "RegisterWithEmailIn",
"required": [
"email",
"password",
"confirmPassword",
"code"
],
"type": "object",
"properties": {
"email": {
"title": "Email",
"type": "string",
"format": "email"
},
"password": {
"title": "Password",
"maxLength": 64,
"minLength": 6,
"type": "string"
},
"confirmPassword": {
"title": "Confirmpassword",
"maxLength": 64,
"minLength": 6,
"type": "string"
},
"code": {
"title": "Code",
"maxLength": 8,
"minLength": 4,
"type": "string"
}
},
"description": "邮箱注册:邮箱 + 密码 + 确认密码 + 验证码"
},
"TagsInList": {
"title": "TagsInList",
"required": [
"tags"
],
"type": "object",
"properties": {
"tags": {
"title": "Tags",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"UserInLogin": {
"title": "UserInLogin",
"required": [
"email",
"password"
],
"type": "object",
"properties": {
"email": {
"title": "Email",
"type": "string",
"format": "email"
},
"password": {
"title": "Password",
"type": "string"
}
}
},
"UserInResponse": {
"title": "UserInResponse",
"required": [
"user"
],
"type": "object",
"properties": {
"user": {
"$ref": "#/components/schemas/UserWithToken"
}
}
},
"UserInUpdate": {
"title": "UserInUpdate",
"type": "object",
"properties": {
"username": {
"title": "Username",
"type": "string"
},
"email": {
"title": "Email",
"type": "string",
"format": "email"
},
"password": {
"title": "Password",
"type": "string"
},
"bio": {
"title": "Bio",
"type": "string"
},
"image": {
"title": "Image",
"maxLength": 2083,
"minLength": 1,
"type": "string",
"format": "uri"
}
}
},
"UserWithToken": {
"title": "UserWithToken",
"required": [
"username",
"email",
"token"
],
"type": "object",
"properties": {
"username": {
"title": "Username",
"type": "string"
},
"email": {
"title": "Email",
"type": "string"
},
"bio": {
"title": "Bio",
"type": "string",
"default": ""
},
"image": {
"title": "Image",
"type": "string"
},
"emailVerified": {
"title": "Emailverified",
"type": "boolean",
"default": false
},
"token": {
"title": "Token",
"type": "string"
}
},
"description": "公开用户信息会被用于文章作者、Profile 等场景)。\n新增 email_verified 字段,便于前端展示与登录后逻辑判断。"
},
"ValidationError": {
"title": "ValidationError",
"required": [
"loc",
"msg",
"type"
],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
}
}
},
"securitySchemes": {
"RWAPIKeyHeader": {
"type": "apiKey",
"in": "header",
"name": "Authorization"
}
}
}
}