YamlMerger/Tests/YAMLSplitterTests/Resources/openapi.yaml

583 lines
15 KiB
YAML

openapi: 3.1.0
info:
title: Demo API
version: 1.0.0
description: A demo OpenAPI specification for testing YAMLSplitter
contact:
name: API Support
email: support@demo.com
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: https://api.demo.com/v1
description: Production server
- url: https://staging-api.demo.com/v1
description: Staging server
- url: http://localhost:8080
description: Local development server
tags:
- name: Users
description: User management operations
- name: Products
description: Product catalog operations
- name: Orders
description: Order management operations
paths:
/users:
get:
tags:
- Users
summary: List all users
description: Retrieve a list of all users
operationId: listUsers
parameters:
- name: limit
in: query
description: Maximum number of users to return
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 10
- name: offset
in: query
description: Number of users to skip
required: false
schema:
type: integer
minimum: 0
default: 0
responses:
'200':
description: List of users
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
tags:
- Users
summary: Create a new user
description: Create a new user account
operationId: createUser
requestBody:
description: User information
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/users/{userId}:
get:
tags:
- Users
summary: Get user by ID
description: Retrieve a specific user by their ID
operationId: getUserById
parameters:
- name: userId
in: path
required: true
description: User ID
schema:
type: string
format: uuid
responses:
'200':
description: User details
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
tags:
- Users
summary: Update user
description: Update an existing user
operationId: updateUser
parameters:
- name: userId
in: path
required: true
description: User ID
schema:
type: string
format: uuid
requestBody:
description: Updated user information
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUserRequest'
responses:
'200':
description: User updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- Users
summary: Delete user
description: Delete a user account
operationId: deleteUser
parameters:
- name: userId
in: path
required: true
description: User ID
schema:
type: string
format: uuid
responses:
'204':
description: User deleted successfully
'404':
description: User not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/products:
get:
tags:
- Products
summary: List all products
description: Retrieve a list of all products
operationId: listProducts
parameters:
- name: category
in: query
description: Filter by product category
required: false
schema:
type: string
- name: minPrice
in: query
description: Minimum price filter
required: false
schema:
type: number
format: decimal
- name: maxPrice
in: query
description: Maximum price filter
required: false
schema:
type: number
format: decimal
responses:
'200':
description: List of products
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Product'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/products/{productId}:
get:
tags:
- Products
summary: Get product by ID
description: Retrieve a specific product by its ID
operationId: getProductById
parameters:
- name: productId
in: path
required: true
description: Product ID
schema:
type: string
format: uuid
responses:
'200':
description: Product details
content:
application/json:
schema:
$ref: '#/components/schemas/Product'
'404':
description: Product not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/orders:
get:
tags:
- Orders
summary: List user orders
description: Retrieve orders for the authenticated user
operationId: listOrders
security:
- bearerAuth: []
responses:
'200':
description: List of orders
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
tags:
- Orders
summary: Create a new order
description: Create a new order
operationId: createOrder
security:
- bearerAuth: []
requestBody:
description: Order information
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateOrderRequest'
responses:
'201':
description: Order created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/orders/{orderId}:
get:
tags:
- Orders
summary: Get order by ID
description: Retrieve a specific order by its ID
operationId: getOrderById
security:
- bearerAuth: []
parameters:
- name: orderId
in: path
required: true
description: Order ID
schema:
type: string
format: uuid
responses:
'200':
description: Order details
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
User:
type: object
required:
- id
- email
- firstName
- lastName
properties:
id:
type: string
format: uuid
description: Unique user identifier
email:
type: string
format: email
description: User email address
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
phone:
type: string
description: User's phone number
dateOfBirth:
type: string
format: date
description: User's date of birth
createdAt:
type: string
format: date-time
description: Account creation timestamp
updatedAt:
type: string
format: date-time
description: Last update timestamp
CreateUserRequest:
type: object
required:
- email
- firstName
- lastName
properties:
email:
type: string
format: email
description: User email address
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
phone:
type: string
description: User's phone number
dateOfBirth:
type: string
format: date
description: User's date of birth
UpdateUserRequest:
type: object
properties:
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
phone:
type: string
description: User's phone number
dateOfBirth:
type: string
format: date
description: User's date of birth
Product:
type: object
required:
- id
- name
- price
- category
properties:
id:
type: string
format: uuid
description: Unique product identifier
name:
type: string
description: Product name
description:
type: string
description: Product description
price:
type: number
format: decimal
description: Product price
category:
type: string
description: Product category
inStock:
type: boolean
description: Whether the product is in stock
stockQuantity:
type: integer
description: Available stock quantity
createdAt:
type: string
format: date-time
description: Product creation timestamp
Order:
type: object
required:
- id
- userId
- items
- total
- status
properties:
id:
type: string
format: uuid
description: Unique order identifier
userId:
type: string
format: uuid
description: User who placed the order
items:
type: array
items:
$ref: '#/components/schemas/OrderItem'
description: Order items
total:
type: number
format: decimal
description: Total order amount
status:
type: string
enum:
- pending
- confirmed
- shipped
- delivered
- cancelled
description: Order status
shippingAddress:
$ref: '#/components/schemas/Address'
createdAt:
type: string
format: date-time
description: Order creation timestamp
updatedAt:
type: string
format: date-time
description: Last update timestamp
OrderItem:
type: object
required:
- productId
- quantity
- price
properties:
productId:
type: string
format: uuid
description: Product identifier
quantity:
type: integer
minimum: 1
description: Quantity ordered
price:
type: number
format: decimal
description: Price per unit
CreateOrderRequest:
type: object
required:
- items
- shippingAddress
properties:
items:
type: array
items:
$ref: '#/components/schemas/OrderItem'
description: Order items
shippingAddress:
$ref: '#/components/schemas/Address'
Address:
type: object
required:
- street
- city
- state
- zipCode
- country
properties:
street:
type: string
description: Street address
city:
type: string
description: City
state:
type: string
description: State or province
zipCode:
type: string
description: ZIP or postal code
country:
type: string
description: Country
Error:
type: object
required:
- code
- message
properties:
code:
type: string
description: Error code
message:
type: string
description: Error message
details:
type: string
description: Additional error details
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT token authentication
security:
- bearerAuth: []
externalDocs:
description: Find more info about the Demo API
url: https://docs.demo.com