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