Skip to content

Commit 1d5555d

Browse files
authored
feat: downgrade openapi spec to v3.0.3 (#121)
1 parent 64e4f2d commit 1d5555d

File tree

2 files changed

+20
-54
lines changed

2 files changed

+20
-54
lines changed

lib/httpapi/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (s *Server) NormalizeSchema(schema any) any {
7070
}
7171

7272
func (s *Server) GetOpenAPI() string {
73-
jsonBytes, err := s.api.OpenAPI().MarshalJSON()
73+
jsonBytes, err := s.api.OpenAPI().Downgrade()
7474
if err != nil {
7575
return ""
7676
}

openapi.json

Lines changed: 19 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"running",
77
"stable"
88
],
9-
"examples": [
10-
"stable"
11-
],
9+
"example": "stable",
1210
"title": "AgentStatus",
1311
"type": "string"
1412
},
@@ -17,9 +15,7 @@
1715
"agent",
1816
"user"
1917
],
20-
"examples": [
21-
"user"
22-
],
18+
"example": "user",
2319
"title": "ConversationRole",
2420
"type": "string"
2521
},
@@ -45,59 +41,45 @@
4541
"properties": {
4642
"$schema": {
4743
"description": "A URL to the JSON Schema for this object.",
48-
"examples": [
49-
"https://example.com/schemas/ErrorModel.json"
50-
],
44+
"example": "https://example.com/schemas/ErrorModel.json",
5145
"format": "uri",
5246
"readOnly": true,
5347
"type": "string"
5448
},
5549
"detail": {
5650
"description": "A human-readable explanation specific to this occurrence of the problem.",
57-
"examples": [
58-
"Property foo is required but is missing."
59-
],
51+
"example": "Property foo is required but is missing.",
6052
"type": "string"
6153
},
6254
"errors": {
6355
"description": "Optional list of individual error details",
6456
"items": {
6557
"$ref": "#/components/schemas/ErrorDetail"
6658
},
67-
"type": [
68-
"array",
69-
"null"
70-
]
59+
"nullable": true,
60+
"type": "array"
7161
},
7262
"instance": {
7363
"description": "A URI reference that identifies the specific occurrence of the problem.",
74-
"examples": [
75-
"https://example.com/error-log/abc123"
76-
],
64+
"example": "https://example.com/error-log/abc123",
7765
"format": "uri",
7866
"type": "string"
7967
},
8068
"status": {
8169
"description": "HTTP status code",
82-
"examples": [
83-
400
84-
],
70+
"example": 400,
8571
"format": "int64",
8672
"type": "integer"
8773
},
8874
"title": {
8975
"description": "A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
90-
"examples": [
91-
"Bad Request"
92-
],
76+
"example": "Bad Request",
9377
"type": "string"
9478
},
9579
"type": {
9680
"default": "about:blank",
9781
"description": "A URI reference to human-readable documentation for the error.",
98-
"examples": [
99-
"https://example.com/errors/example"
100-
],
82+
"example": "https://example.com/errors/example",
10183
"format": "uri",
10284
"type": "string"
10385
}
@@ -109,9 +91,7 @@
10991
"properties": {
11092
"content": {
11193
"description": "Message content. The message is formatted as it appears in the agent's terminal session, meaning that, by default, it consists of lines of text with 80 characters per line.",
112-
"examples": [
113-
"Hello world"
114-
],
94+
"example": "Hello world",
11595
"type": "string"
11696
},
11797
"id": {
@@ -142,18 +122,14 @@
142122
"properties": {
143123
"$schema": {
144124
"description": "A URL to the JSON Schema for this object.",
145-
"examples": [
146-
"https://example.com/schemas/MessageRequestBody.json"
147-
],
125+
"example": "https://example.com/schemas/MessageRequestBody.json",
148126
"format": "uri",
149127
"readOnly": true,
150128
"type": "string"
151129
},
152130
"content": {
153131
"description": "Message content",
154-
"examples": [
155-
"Hello, agent!"
156-
],
132+
"example": "Hello, agent!",
157133
"type": "string"
158134
},
159135
"type": {
@@ -172,9 +148,7 @@
172148
"properties": {
173149
"$schema": {
174150
"description": "A URL to the JSON Schema for this object.",
175-
"examples": [
176-
"https://example.com/schemas/MessageResponseBody.json"
177-
],
151+
"example": "https://example.com/schemas/MessageResponseBody.json",
178152
"format": "uri",
179153
"readOnly": true,
180154
"type": "string"
@@ -194,9 +168,7 @@
194168
"raw",
195169
"user"
196170
],
197-
"examples": [
198-
"user"
199-
],
171+
"example": "user",
200172
"title": "MessageType",
201173
"type": "string"
202174
},
@@ -235,9 +207,7 @@
235207
"properties": {
236208
"$schema": {
237209
"description": "A URL to the JSON Schema for this object.",
238-
"examples": [
239-
"https://example.com/schemas/MessagesResponseBody.json"
240-
],
210+
"example": "https://example.com/schemas/MessagesResponseBody.json",
241211
"format": "uri",
242212
"readOnly": true,
243213
"type": "string"
@@ -290,9 +260,7 @@
290260
"properties": {
291261
"$schema": {
292262
"description": "A URL to the JSON Schema for this object.",
293-
"examples": [
294-
"https://example.com/schemas/StatusResponseBody.json"
295-
],
263+
"example": "https://example.com/schemas/StatusResponseBody.json",
296264
"format": "uri",
297265
"readOnly": true,
298266
"type": "string"
@@ -317,9 +285,7 @@
317285
"properties": {
318286
"$schema": {
319287
"description": "A URL to the JSON Schema for this object.",
320-
"examples": [
321-
"https://example.com/schemas/UploadResponseBody.json"
322-
],
288+
"example": "https://example.com/schemas/UploadResponseBody.json",
323289
"format": "uri",
324290
"readOnly": true,
325291
"type": "string"
@@ -346,7 +312,7 @@
346312
"title": "AgentAPI",
347313
"version": "0.10.0"
348314
},
349-
"openapi": "3.1.0",
315+
"openapi": "3.0.3",
350316
"paths": {
351317
"/events": {
352318
"get": {

0 commit comments

Comments
 (0)