Skip to content

Instantly share code, notes, and snippets.

@TharmiganK
Created May 6, 2024 14:52
Show Gist options
  • Save TharmiganK/9fb5e61220fafd7bb6a42173b24efb51 to your computer and use it in GitHub Desktop.
Save TharmiganK/9fb5e61220fafd7bb6a42173b24efb51 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.1",
"info": {
"title": "Text Processing",
"version": "0.1.0"
},
"servers": [
{
"url": "{server}:{port}/text-processing",
"variables": {
"server": {
"default": "http://localhost"
},
"port": {
"default": "9098"
}
}
}
],
"paths": {
"/api/sentiment": {
"post": {
"operationId": "postApiSentiment",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Sentiment"
}
}
}
},
"400": {
"description": "BadRequest",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorPayload"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ErrorPayload": {
"required": [
"message",
"method",
"path",
"reason",
"status",
"timestamp"
],
"type": "object",
"properties": {
"timestamp": {
"type": "string"
},
"status": {
"type": "integer",
"format": "int64"
},
"reason": {
"type": "string"
},
"message": {
"type": "string"
},
"path": {
"type": "string"
},
"method": {
"type": "string"
}
}
},
"Post": {
"required": [
"text"
],
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
},
"Probability": {
"required": [
"neg",
"neutral",
"pos"
],
"type": "object",
"properties": {
"neg": {
"type": "number",
"format": "double"
},
"neutral": {
"type": "number",
"format": "double"
},
"pos": {
"type": "number",
"format": "double"
}
}
},
"Sentiment": {
"required": [
"label",
"probability"
],
"type": "object",
"properties": {
"probability": {
"$ref": "#/components/schemas/Probability"
},
"label": {
"type": "string"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment