development-ib-fork/web/05/eigene_loesungen/Antwort_5_Ubeung.json

110 lines
1.9 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 Parameter",
"schema":{
"type": "string"
},
"example": "Mr. X"
}
],
"responses": {
"200": {
"description": "Greeting response in plain text.",
"content": {
"text/plain": {
"schema": {
"type": "string"
},
"example": "Hello!"
}
}
}
}
},
"post": {
"summary": "Returns a plain text greeting",
"requestBody":{
"required": true,
"content": {
"text/plain":{
"schema":{
"type": "string",
"example": "YEET"
}
}
}
},
"responses": {
"200": {
"description": "Plain text greeting response",
"content": {
"text/plain": {
"schema": {
"type": "string"
},
"example": "Hello!"
}
}
}
}
}
},
"/hello-json":{
"post":{
"summary": "Ein hello/json greeting",
"requestBody":{
"required": true,
"content": {
"application/json":{
"schema":{
"type": "object",
"properties": {
"name":{
"type":"string",
"example":"Alice"
},
"age":{
"type":"integer",
"example":"23"
}
},
"required": ["name", "age"]
}
}
}
},
"responses": {
"200": {
"description": "Json text greeting response",
"content": {
"text/plain": {
"schema": {
"type": "string"
},
"example": "Daten erhalten!"
}
}
}
}
}
}
}
}