test-swagger-example.json•2.55 kB
{
"openapi": "3.0.0",
"info": {
"title": "JSONPlaceholder API",
"version": "1.0.0",
"description": "Fake REST API for testing and prototyping"
},
"servers": [
{
"url": "https://jsonplaceholder.typicode.com",
"description": "JSONPlaceholder server"
}
],
"paths": {
"/posts": {
"get": {
"operationId": "getPosts",
"summary": "Get all posts",
"description": "Retrieve a list of all posts",
"parameters": [
{
"name": "userId",
"in": "query",
"description": "Filter by user ID",
"required": false,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response"
}
}
},
"post": {
"operationId": "createPost",
"summary": "Create a new post",
"description": "Create a new post",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"body": {
"type": "string"
},
"userId": {
"type": "integer"
}
},
"required": ["title", "body", "userId"]
}
}
}
},
"responses": {
"201": {
"description": "Post created successfully"
}
}
}
},
"/posts/{id}": {
"get": {
"operationId": "getPost",
"summary": "Get a specific post",
"description": "Retrieve a specific post by ID",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Post ID",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response"
}
}
}
},
"/users": {
"get": {
"operationId": "getUsers",
"summary": "Get all users",
"description": "Retrieve a list of all users",
"responses": {
"200": {
"description": "Successful response"
}
}
}
}
}
}