feat(api-docs): add OpenAPI documentation for authentication endpoints

This commit is contained in:
2026-06-05 19:18:42 +03:30
parent 0b99ab2119
commit 07d80b8740

View File

@@ -0,0 +1,202 @@
{
"openapi": "3.0.0",
"info": {
"title": "Hoshpoint API",
"description": "API documentation for Hoshpoint backend",
"version": "1.0.0"
},
"servers": [
{
"url": "/api",
"description": "API server"
}
],
"paths": {
"/auth/register": {
"post": {
"tags": [
"Auth"
],
"summary": "Register",
"description": "Register a new user account",
"operationId": "08136088c4862c313b35d6518bab8d3a",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"name",
"mobile",
"email",
"password"
],
"properties": {
"name": {
"type": "string",
"example": "علی رضایی"
},
"mobile": {
"type": "string",
"example": "09123456789"
},
"email": {
"type": "string",
"format": "email",
"example": "ali@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "password123"
}
},
"type": "object"
}
}
}
},
"responses": {
"201": {
"description": "Registered successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "ثبت‌نام با موفقیت انجام شد."
},
"data": {
"properties": {
"user": {
"$ref": "#/components/schemas/User"
},
"token": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Validation error"
}
}
}
},
"/auth/login": {
"post": {
"tags": [
"Auth"
],
"summary": "Login",
"description": "Login with email or username",
"operationId": "99d66635c4992aeaa6aa44ff653d0563",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"required": [
"login",
"password"
],
"properties": {
"login": {
"description": "Email or username",
"type": "string",
"example": "ali@example.com"
},
"password": {
"type": "string",
"format": "password",
"example": "password123"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Logged in successfully",
"content": {
"application/json": {
"schema": {
"properties": {
"message": {
"type": "string",
"example": "ورود با موفقیت انجام شد."
},
"data": {
"properties": {
"user": {
"$ref": "#/components/schemas/User"
},
"token": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"422": {
"description": "Invalid credentials"
}
}
}
}
},
"components": {
"schemas": {
"User": {
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "علی رضایی"
},
"username": {
"type": "string",
"example": "ali"
},
"email": {
"type": "string",
"format": "email",
"example": "ali@example.com"
},
"mobile": {
"type": "string",
"example": "09123456789"
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"type": "object"
}
}
},
"tags": [
{
"name": "Auth",
"description": "Authentication endpoints"
}
]
}