136 lines
4.2 KiB
JSON
136 lines
4.2 KiB
JSON
{
|
|
"openapi": "3.0.3",
|
|
"info": {
|
|
"title": "User Management API",
|
|
"version": "1.0.0",
|
|
"description": "A simple API to manage users"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://api.example.com/v1",
|
|
"description": "Production server"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/users": {
|
|
"get": {
|
|
"summary": "List all users",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A list of users",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/User"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Create a new user",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": "User created successfully"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/users/{userId}": {
|
|
"get": {
|
|
"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": {
|
|
"$ref": "#/components/schemas/User"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "User not found"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"User": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"example": "123",
|
|
"description": "The unique identifier for the user"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "John Doe"
|
|
},
|
|
"email": {
|
|
"type": "string",
|
|
"example": "john.doe@example.com"
|
|
},
|
|
"user_profile": {
|
|
"type": "object",
|
|
"properties": {
|
|
"age": {
|
|
"type": "integer"
|
|
},
|
|
"address": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"name",
|
|
"email"
|
|
]
|
|
},
|
|
"UserBalance": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"example": "123",
|
|
"description": "The unique identifier for the user"
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"example": "John Doe"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |