99 lines
2.9 KiB
YAML
99 lines
2.9 KiB
YAML
openapi: 3.0.3
|
|
info: { title: User API, version: 1.0.0 }
|
|
servers: [ { url: https://your-domain.com/api/v1 } ]
|
|
tags: [ { name: Users } ]
|
|
security: [ { bearerAuth: [] } ]
|
|
|
|
paths:
|
|
/profile:
|
|
get:
|
|
tags: [Users]
|
|
summary: Get current user profile
|
|
responses:
|
|
"200": { description: Profile }
|
|
"404": { description: Not found }
|
|
post:
|
|
tags: [Users]
|
|
summary: Authenticate and return profile with JWT
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required: [email, password]
|
|
properties:
|
|
email:
|
|
type: string
|
|
format: email
|
|
example: parent@example.com
|
|
password:
|
|
type: string
|
|
example: StrongPass123
|
|
example:
|
|
email: parent@example.com
|
|
password: StrongPass123
|
|
responses:
|
|
"200":
|
|
description: Login successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ProfileAuthResponse'
|
|
"400":
|
|
description: Missing credentials
|
|
"401":
|
|
description: Invalid credentials
|
|
put:
|
|
tags: [Users]
|
|
summary: Update current user profile
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
firstname: { type: string }
|
|
lastname: { type: string }
|
|
email: { type: string, format: email }
|
|
password: { type: string, minLength: 8 }
|
|
current_password: { type: string }
|
|
cellphone: { type: string }
|
|
address_street: { type: string }
|
|
apt: { type: string }
|
|
city: { type: string }
|
|
state: { type: string }
|
|
zip: { type: string }
|
|
gender: { type: string }
|
|
responses:
|
|
"200": { description: Profile updated }
|
|
|
|
components:
|
|
schemas:
|
|
ProfileAuthRequest:
|
|
type: object
|
|
required: [email, password]
|
|
properties:
|
|
email: { type: string, format: email, example: parent@example.com }
|
|
password: { type: string, example: StrongPass123 }
|
|
ProfileAuthResponse:
|
|
type: object
|
|
properties:
|
|
status:
|
|
type: boolean
|
|
example: true
|
|
token:
|
|
type: string
|
|
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
|
user:
|
|
type: object
|
|
properties:
|
|
id: { type: integer, example: 17 }
|
|
name: { type: string, example: "Jane Doe" }
|
|
email: { type: string, format: email, example: parent@example.com }
|
|
roles:
|
|
type: object
|
|
additionalProperties: { type: boolean }
|
|
example: { parent: true }
|