88 lines
1.9 KiB
YAML
88 lines
1.9 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: User CRUD API
|
|
version: 1.0.0
|
|
servers:
|
|
- url: https://api.example.com/v1
|
|
paths:
|
|
/users/{userId}:
|
|
get:
|
|
tags:
|
|
- users
|
|
operationId: getUserById
|
|
summary: Get a user by ID
|
|
parameters:
|
|
- name: userId
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: User details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
user:
|
|
$ref: '#/components/schemas/User'
|
|
required:
|
|
- user
|
|
|
|
|
|
|
|
'404':
|
|
description: User not found
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
example: "User not found"
|
|
required:
|
|
- message
|
|
/users:
|
|
post:
|
|
tags:
|
|
- users
|
|
operationId: createUser
|
|
summary: "Create a new user with phone number"
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/UserCreate'
|
|
responses:
|
|
'200':
|
|
description: User created successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/User'
|
|
components:
|
|
schemas:
|
|
User:
|
|
type: object
|
|
properties:
|
|
uuid:
|
|
type: string
|
|
example: "123"
|
|
phone_number:
|
|
type: string
|
|
example: "johndoe"
|
|
required:
|
|
- uuid
|
|
- phone_number
|
|
UserCreate:
|
|
type: object
|
|
properties:
|
|
phone_number:
|
|
type: string
|
|
|
|
required:
|
|
- phone_number
|