-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenapi.yaml
92 lines (92 loc) · 2.81 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
openapi: "3.1.0"
info:
version: 0.1.0
title: Comment Vibe API
paths:
/comment/{surveyId}:
post:
summary: Submit comment to survey
operationId: comment
parameters:
- name: surveyId
in: query
description: The Survey ID to attach comment to
required: true
schema:
type: string
requestBody:
description: New comment as JSON, without sentiment
content:
application/json:
schema:
$ref: "#/components/schemas/Comment"
required: true
responses:
"200":
description: Returns the comment with sentiment attached
content:
application/json:
type: object
properties:
action: add
data:
schema:
$ref: "#/components/schemas/Comment"
/report/{surveyId}:
get:
summary: Report sentiment summary for survey
operationId: report
parameters:
- name: surveyId
in: query
description: The Survey ID to report on
required: true
schema:
type: string
responses:
"200":
description: Comment sentiment report
content:
application/json:
type: object
properties:
action: report
data:
type: object
properties:
surveyId:
type: string
description: Survey ID for this report
positiveCount:
type: number
description: Number of survey comments with sentiment > 1
negativeCount:
type: number
description: Number of survey comments with sentiment < -1
neutralCount:
type: number
description: Number of survey comments with -1 < sentiment < 1
averageSentiment:
type: number
description: Average sentiment value of comments in this survey
components:
schemas:
Comment:
type: object
required:
- surveyId
- datetime
- content
properties:
surveyId:
type: string
description: Survey ID this comment is attached to
datetime:
type: string
description: Timestamp of when this comment was submitted. ISO format.
content:
type: string
description: Comment text
sentiment:
type: number
description: Sentiment rating from -5 (negative) to 5 (positive) as calculated by AFINN-165. See https://www.npmjs.com/package/afinn-165