Skip to content

Commit 89b3a67

Browse files
docs(api): generate OpenAPI spec for FastAPI app (JSON+YAML) in src/benchmesh_service/doc
Co-authored-by: openhands <openhands@all-hands.dev>
1 parent b8261a2 commit 89b3a67

2 files changed

Lines changed: 387 additions & 0 deletions

File tree

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "BenchMesh Serial Service",
5+
"version": "0.1.0"
6+
},
7+
"paths": {
8+
"/status": {
9+
"get": {
10+
"summary": "Service status",
11+
"operationId": "get_status_status_get",
12+
"responses": {
13+
"200": {
14+
"description": "Successful Response",
15+
"content": {
16+
"application/json": {
17+
"schema": {
18+
"additionalProperties": true,
19+
"type": "object",
20+
"title": "Response Get Status Status Get"
21+
}
22+
}
23+
}
24+
}
25+
}
26+
}
27+
},
28+
"/instruments": {
29+
"get": {
30+
"summary": "List instruments and last IDN",
31+
"operationId": "list_instruments_instruments_get",
32+
"responses": {
33+
"200": {
34+
"description": "Successful Response",
35+
"content": {
36+
"application/json": {
37+
"schema": {
38+
"items": {},
39+
"type": "array",
40+
"title": "Response List Instruments Instruments Get"
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}
47+
},
48+
"/instruments/{klass}/{device_id}/{channel}/{method}": {
49+
"get": {
50+
"summary": "Call driver method (read-only)",
51+
"operationId": "call_driver_get_instruments__klass___device_id___channel___method__get",
52+
"parameters": [
53+
{
54+
"name": "klass",
55+
"in": "path",
56+
"required": true,
57+
"schema": {
58+
"type": "string",
59+
"title": "Klass"
60+
}
61+
},
62+
{
63+
"name": "device_id",
64+
"in": "path",
65+
"required": true,
66+
"schema": {
67+
"type": "string",
68+
"title": "Device Id"
69+
}
70+
},
71+
{
72+
"name": "channel",
73+
"in": "path",
74+
"required": true,
75+
"schema": {
76+
"type": "string",
77+
"title": "Channel"
78+
}
79+
},
80+
{
81+
"name": "method",
82+
"in": "path",
83+
"required": true,
84+
"schema": {
85+
"type": "string",
86+
"title": "Method"
87+
}
88+
}
89+
],
90+
"responses": {
91+
"200": {
92+
"description": "Successful Response",
93+
"content": {
94+
"application/json": {
95+
"schema": {}
96+
}
97+
}
98+
},
99+
"422": {
100+
"description": "Validation Error",
101+
"content": {
102+
"application/json": {
103+
"schema": {
104+
"$ref": "#/components/schemas/HTTPValidationError"
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
},
112+
"/instruments/{klass}/{device_id}/{channel}/{method}/{param}": {
113+
"post": {
114+
"summary": "Call driver method (write)",
115+
"operationId": "call_driver_post_instruments__klass___device_id___channel___method___param__post",
116+
"parameters": [
117+
{
118+
"name": "klass",
119+
"in": "path",
120+
"required": true,
121+
"schema": {
122+
"type": "string",
123+
"title": "Klass"
124+
}
125+
},
126+
{
127+
"name": "device_id",
128+
"in": "path",
129+
"required": true,
130+
"schema": {
131+
"type": "string",
132+
"title": "Device Id"
133+
}
134+
},
135+
{
136+
"name": "channel",
137+
"in": "path",
138+
"required": true,
139+
"schema": {
140+
"type": "string",
141+
"title": "Channel"
142+
}
143+
},
144+
{
145+
"name": "method",
146+
"in": "path",
147+
"required": true,
148+
"schema": {
149+
"type": "string",
150+
"title": "Method"
151+
}
152+
},
153+
{
154+
"name": "param",
155+
"in": "path",
156+
"required": true,
157+
"schema": {
158+
"type": "string",
159+
"title": "Param"
160+
}
161+
}
162+
],
163+
"responses": {
164+
"200": {
165+
"description": "Successful Response",
166+
"content": {
167+
"application/json": {
168+
"schema": {}
169+
}
170+
}
171+
},
172+
"422": {
173+
"description": "Validation Error",
174+
"content": {
175+
"application/json": {
176+
"schema": {
177+
"$ref": "#/components/schemas/HTTPValidationError"
178+
}
179+
}
180+
}
181+
}
182+
}
183+
}
184+
}
185+
},
186+
"components": {
187+
"schemas": {
188+
"HTTPValidationError": {
189+
"properties": {
190+
"detail": {
191+
"items": {
192+
"$ref": "#/components/schemas/ValidationError"
193+
},
194+
"type": "array",
195+
"title": "Detail"
196+
}
197+
},
198+
"type": "object",
199+
"title": "HTTPValidationError"
200+
},
201+
"ValidationError": {
202+
"properties": {
203+
"loc": {
204+
"items": {
205+
"anyOf": [
206+
{
207+
"type": "string"
208+
},
209+
{
210+
"type": "integer"
211+
}
212+
]
213+
},
214+
"type": "array",
215+
"title": "Location"
216+
},
217+
"msg": {
218+
"type": "string",
219+
"title": "Message"
220+
},
221+
"type": {
222+
"type": "string",
223+
"title": "Error Type"
224+
}
225+
},
226+
"type": "object",
227+
"required": [
228+
"loc",
229+
"msg",
230+
"type"
231+
],
232+
"title": "ValidationError"
233+
}
234+
}
235+
}
236+
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
openapi: 3.1.0
2+
info:
3+
title: BenchMesh Serial Service
4+
version: 0.1.0
5+
paths:
6+
/status:
7+
get:
8+
summary: Service status
9+
operationId: get_status_status_get
10+
responses:
11+
'200':
12+
description: Successful Response
13+
content:
14+
application/json:
15+
schema:
16+
additionalProperties: true
17+
type: object
18+
title: Response Get Status Status Get
19+
/instruments:
20+
get:
21+
summary: List instruments and last IDN
22+
operationId: list_instruments_instruments_get
23+
responses:
24+
'200':
25+
description: Successful Response
26+
content:
27+
application/json:
28+
schema:
29+
items: {}
30+
type: array
31+
title: Response List Instruments Instruments Get
32+
/instruments/{klass}/{device_id}/{channel}/{method}:
33+
get:
34+
summary: Call driver method (read-only)
35+
operationId: call_driver_get_instruments__klass___device_id___channel___method__get
36+
parameters:
37+
- name: klass
38+
in: path
39+
required: true
40+
schema:
41+
type: string
42+
title: Klass
43+
- name: device_id
44+
in: path
45+
required: true
46+
schema:
47+
type: string
48+
title: Device Id
49+
- name: channel
50+
in: path
51+
required: true
52+
schema:
53+
type: string
54+
title: Channel
55+
- name: method
56+
in: path
57+
required: true
58+
schema:
59+
type: string
60+
title: Method
61+
responses:
62+
'200':
63+
description: Successful Response
64+
content:
65+
application/json:
66+
schema: {}
67+
'422':
68+
description: Validation Error
69+
content:
70+
application/json:
71+
schema:
72+
$ref: '#/components/schemas/HTTPValidationError'
73+
/instruments/{klass}/{device_id}/{channel}/{method}/{param}:
74+
post:
75+
summary: Call driver method (write)
76+
operationId: call_driver_post_instruments__klass___device_id___channel___method___param__post
77+
parameters:
78+
- name: klass
79+
in: path
80+
required: true
81+
schema:
82+
type: string
83+
title: Klass
84+
- name: device_id
85+
in: path
86+
required: true
87+
schema:
88+
type: string
89+
title: Device Id
90+
- name: channel
91+
in: path
92+
required: true
93+
schema:
94+
type: string
95+
title: Channel
96+
- name: method
97+
in: path
98+
required: true
99+
schema:
100+
type: string
101+
title: Method
102+
- name: param
103+
in: path
104+
required: true
105+
schema:
106+
type: string
107+
title: Param
108+
responses:
109+
'200':
110+
description: Successful Response
111+
content:
112+
application/json:
113+
schema: {}
114+
'422':
115+
description: Validation Error
116+
content:
117+
application/json:
118+
schema:
119+
$ref: '#/components/schemas/HTTPValidationError'
120+
components:
121+
schemas:
122+
HTTPValidationError:
123+
properties:
124+
detail:
125+
items:
126+
$ref: '#/components/schemas/ValidationError'
127+
type: array
128+
title: Detail
129+
type: object
130+
title: HTTPValidationError
131+
ValidationError:
132+
properties:
133+
loc:
134+
items:
135+
anyOf:
136+
- type: string
137+
- type: integer
138+
type: array
139+
title: Location
140+
msg:
141+
type: string
142+
title: Message
143+
type:
144+
type: string
145+
title: Error Type
146+
type: object
147+
required:
148+
- loc
149+
- msg
150+
- type
151+
title: ValidationError

0 commit comments

Comments
 (0)