forked from WEB-IMB-WS2526/lab-development-imb
112 lines
2.0 KiB
JSON
112 lines
2.0 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "Simple Greeting API",
|
|
"version": "1.0.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "http://localhost:8080"
|
|
}
|
|
],
|
|
"paths": {
|
|
"/hello": {
|
|
"get": {
|
|
"summary": "Returns a greeting",
|
|
"parameters": [
|
|
{
|
|
"name": "name",
|
|
"in": "query",
|
|
"required": true,
|
|
"description": "Name of the person to greet",
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"example": "Deepak"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful response",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"example": "Hello, Deepak!"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"summary": "Accepts a plain text name and returns a plain text greeting",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"example": "Deepika"
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Plain text greeting response",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"example": "Hello, Deepika!"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/hello-json": {
|
|
"post": {
|
|
"summary": "Accepts a json with name and age and returns a plain text greeting",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"required": [
|
|
"name"
|
|
],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"example": "Florian"
|
|
},
|
|
"age": {
|
|
"type": "integer",
|
|
"example": 23
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Plain text greeting response",
|
|
"content": {
|
|
"text/plain": {
|
|
"schema": {
|
|
"type": "string"
|
|
},
|
|
"example": "Hello, 23-year-old Florian!"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |