Add some typedef to reduce the size of the lines
[apps/agl-service-can-low-level.git] / low-can-binding / binding / low-can-apidef.json
1 {
2         "openapi": "3.0.0",
3         "$schema": "http:iot.bzh/download/openapi/schema-3.0/default-schema.json",
4         "info": {
5                 "description": "",
6                 "title": "low-can",
7                 "version": "4.0",
8                 "x-binding-c-generator": {
9                         "api": "low-can",
10                         "version": 2,
11                         "prefix": "",
12                         "postfix": "",
13                         "start": null ,
14                         "onevent": null,
15                         "init": "init_binding",
16                         "scope": "",
17                         "private": false
18                 }
19         },
20         "servers": [
21                 {
22                         "url": "ws://{host}:{port}/api/monitor",
23                         "description": "Low level CAN API.",
24                         "variables": {
25                                 "host": {
26                                         "default": "localhost"
27                                 },
28                                 "port": {
29                                         "default": "1234"
30                                 }
31                         },
32                         "x-afb-events": [
33                                 {
34                                         "$ref": "#/components/schemas/afb-event"
35                                 }
36                         ]
37                 }
38         ],
39         "components": {
40                 "schemas": {
41                         "afb-reply": {
42                                 "$ref": "#/components/schemas/afb-reply-v2"
43                         },
44                         "afb-event": {
45                                 "$ref": "#/components/schemas/afb-event-v2"
46                         },
47                         "afb-reply-v2": {
48                                 "title": "Generic response.",
49                                 "type": "object",
50                                 "required": [ "jtype", "request" ],
51                                 "properties": {
52                                         "jtype": {
53                                                 "type": "string",
54                                                 "const": "afb-reply"
55                                         },
56                                         "request": {
57                                                 "type": "object",
58                                                 "required": [ "status" ],
59                                                 "properties": {
60                                                         "status": { "type": "string" },
61                                                         "info": { "type": "string" },
62                                                         "token": { "type": "string" },
63                                                         "uuid": { "type": "string" },
64                                                         "reqid": { "type": "string" }
65                                                 }
66                                         },
67                                         "response": { "type": "object" }
68                                 }
69                         },
70                         "afb-event-v2": {
71                                 "type": "object",
72                                 "required": [ "jtype", "event" ],
73                                 "properties": {
74                                         "jtype": {
75                                                 "type": "string",
76                                                 "const": "afb-event"
77                                         },
78                                         "event": { "type": "string" },
79                                         "data": { "type": "object" }
80                                 }
81                         }
82                 },
83                 "x-permissions": {
84                                 "monitor": {
85                                         "permission": "urn:AGL:permission:low-can:public:monitor"
86                                 },
87                                 "write": {
88                                         "permission": "urn:AGL:permission::platform:can:write "
89                                 }
90                 },
91                 "responses": {
92                                                 "200": {
93                                                         "description": "A complex object array response",
94                                                         "content": {
95                                                                 "application/json": {
96                                                                         "schema": {
97                                                                                 "$ref": "#/components/schemas/afb-reply"
98                                                                         }
99                                                                 }
100                                                 }
101                                         }
102                 }
103         },
104         "paths": {
105                 "/subscribe": {
106                         "description": "Subscribe to CAN signals events",
107                                 "parameters": [
108                                         {
109                                                 "in": "query",
110                                                 "name": "event",
111                                                 "required": false,
112                                                 "schema": { "type": "string" }
113                                         }
114                                 ],
115                                 "responses": {
116                                         "200": {"$ref": "#/components/responses/200"}
117                                 }
118                         },
119                 "/unsubscribe": {
120                         "description": "Unsubscribe previously subscribed signals.",
121                                 "parameters": [
122                                         {
123                                                 "in": "query",
124                                                 "name": "event",
125                                                 "required": false,
126                                                 "schema": { "type": "string" }
127                                         }
128                                 ],
129                                 "responses": {
130                                         "200": {"$ref": "#/components/responses/200"}
131                                 }
132                         },
133                         "/get": {
134                                 "description": "get a current value of CAN message",
135                                         "parameters": [
136                                                 {
137                                                         "in": "query",
138                                                         "name": "event",
139                                                         "required": false,
140                                                         "schema": { "type": "string" }
141                                                 }
142                                         ],
143                                         "responses": {
144                                                 "200": {"$ref": "#/components/responses/200"}
145                                         }
146                                 },
147                         "/list": {
148                                 "description": "get a supported CAN message list",
149                                         "responses": {
150                                                 "200": {"$ref": "#/components/responses/200"}
151                                         }
152                                 },
153                 "/auth": {
154                         "description": "Authenticate session to be raise Level Of Assurance.",
155                         "get": {
156                                 "x-permissions": {
157                                         "$ref": "#/components/x-permissions/write"
158                                 },
159                                 "responses": {
160                                         "200": {"$ref": "#/components/responses/200"}
161                                 }
162                         }
163                 },
164                 "/write": {
165                         "description": "Write a CAN messages to the CAN bus.",
166                         "get": {
167                                 "x-permissions": {
168                                         "LOA": 1
169                                 },
170                                 "parameters": [
171                                         {
172                                                 "in": "query",
173                                                 "name": "bus_name",
174                                                 "required": false,
175                                                 "schema": { "type": "string" }
176                                 },
177                                 {
178                                                 "in": "query",
179                                                 "name": "frame",
180                                                 "required": false,
181                         "schema": { "type": "array" },
182                         "parameters": [
183                         {
184                                 "in": "query",
185                                 "name": "can_id",
186                                 "required": false,
187                                 "schema": { "type": "string" }
188                         },
189                         {
190                                 "in": "query",
191                                 "name": "can_dlc",
192                                 "required": false,
193                                 "schema": { "type": "string" }
194                         },
195                         {
196                                 "in": "query",
197                                 "name": "can_data",
198                                 "required": false,
199                                 "schema": { "type": "string" }
200                         }
201                         ]
202                         },
203                 {
204                                                 "in": "query",
205                                                 "name": "signal_name",
206                                                 "required": false,
207                                                 "schema": { "type": "string" }
208                 },
209                 {
210                                                 "in": "query",
211                                                 "name": "signal_value",
212                                                 "required": false,
213                                                 "schema": { "type": "integer" }
214                                 }
215                                 ],
216                                 "responses": {
217                                         "200": {"$ref": "#/components/responses/200"}
218                                 }
219                         }
220                 }
221         }
222 }