Files
mtg-search/backend/openapi/api.yaml
T
2026-04-27 22:36:44 +09:30

163 lines
3.4 KiB
YAML

openapi: 3.0.0
info:
title: MTG Search API
version: 0.1.0
description: Magic The Gathering Card Search REST API
contact:
name: API Support
url: https://github.com/example/mtg-search
license:
name: MIT
servers:
- url: http://localhost:8080
description: Development server
- url: https://api.mtgsearch.example.com
description: Production server
paths:
/api/v1/auth/register:
post:
tags:
- Authentication
summary: Register a new user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterRequest'
responses:
'201':
description: User registered successfully
content:
application/json:
schema:
$ref: '#/components/schemas/UserResponse'
'400':
description: Invalid input
'409':
description: User already exists
/api/v1/auth/login:
post:
tags:
- Authentication
summary: Login user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRequest'
responses:
'200':
description: Login successful
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'401':
description: Invalid credentials
'500':
description: Server error
/api/v1/auth/health:
get:
tags:
- Health
summary: Health check
responses:
'200':
description: Service is healthy
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
components:
schemas:
RegisterRequest:
type: object
required:
- username
- email
- password
properties:
username:
type: string
minLength: 3
maxLength: 100
example: john_doe
email:
type: string
format: email
example: john@example.com
password:
type: string
format: password
minLength: 8
example: SecurePassword123!
LoginRequest:
type: object
required:
- username
- password
properties:
username:
type: string
example: john_doe
password:
type: string
format: password
example: SecurePassword123!
UserResponse:
type: object
properties:
id:
type: integer
format: int64
username:
type: string
email:
type: string
message:
type: string
error:
type: string
LoginResponse:
type: object
properties:
token:
type: string
description: JWT token for authentication
id:
type: integer
format: int64
username:
type: string
email:
type: string
error:
type: string
HealthResponse:
type: object
properties:
status:
type: string
enum:
- ok
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- bearerAuth: []