You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-generate discriminated unions from OpenAPI discriminators
- Add discriminators to OpenAPI spec for transport and Argument types
- Enhance schema generation tool to auto-convert discriminators to allOf with if/then blocks
- Replace manual discriminated union patterns with auto-generated schema
- Ensures schema stays in sync with OpenAPI spec and produces cleaner validation errors
Copy file name to clipboardExpand all lines: docs/reference/api/openapi.yaml
+19-4Lines changed: 19 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -347,11 +347,16 @@ components:
347
347
description: A hint to help clients determine the appropriate runtime for the package. This field should be provided when `runtimeArguments` are present.
description: Transport protocol configuration for the package
355
360
runtimeArguments:
356
361
type: array
357
362
description: A list of arguments to be passed to the package's runtime command (such as docker or npx). The `runtimeHint` field should be provided when `runtimeArguments` are present.
@@ -478,7 +483,12 @@ components:
478
483
479
484
Argument:
480
485
description: "Warning: Arguments construct command-line parameters that may contain user-provided input. This creates potential command injection risks if clients execute commands in a shell environment. For example, a malicious argument value like ';rm -rf ~/Development' could execute dangerous commands. Clients should prefer non-shell execution methods (e.g., posix_spawn) when possible to eliminate injection risks entirely. Where not possible, clients should obtain consent from users or agents to run the resolved command before execution."
"description": "Warning: Arguments construct command-line parameters that may contain user-provided input. This creates potential command injection risks if clients execute commands in a shell environment. For example, a malicious argument value like ';rm -rf ~/Development' could execute dangerous commands. Clients should prefer non-shell execution methods (e.g., posix_spawn) when possible to eliminate injection risks entirely. Where not possible, clients should obtain consent from users or agents to run the resolved command before execution.",
35
+
"properties": {
36
+
"type": {
37
+
"enum": [
38
+
"positional",
39
+
"named"
40
+
],
41
+
"type": "string"
14
42
}
43
+
},
44
+
"required": [
45
+
"type"
15
46
],
16
-
"description": "Warning: Arguments construct command-line parameters that may contain user-provided input. This creates potential command injection risks if clients execute commands in a shell environment. For example, a malicious argument value like ';rm -rf ~/Development' could execute dangerous commands. Clients should prefer non-shell execution methods (e.g., posix_spawn) when possible to eliminate injection risks entirely. Where not possible, clients should obtain consent from users or agents to run the resolved command before execution."
47
+
"type": "object"
17
48
},
18
49
"Icon": {
19
50
"description": "An optionally-sized icon that can be displayed in a user interface.",
@@ -262,18 +293,58 @@
262
293
"type": "string"
263
294
},
264
295
"transport": {
265
-
"anyOf": [
296
+
"allOf": [
266
297
{
267
-
"$ref": "#/definitions/StdioTransport"
298
+
"if": {
299
+
"properties": {
300
+
"type": {
301
+
"const": "stdio"
302
+
}
303
+
}
304
+
},
305
+
"then": {
306
+
"$ref": "#/definitions/StdioTransport"
307
+
}
268
308
},
269
309
{
270
-
"$ref": "#/definitions/StreamableHttpTransport"
310
+
"if": {
311
+
"properties": {
312
+
"type": {
313
+
"const": "streamable-http"
314
+
}
315
+
}
316
+
},
317
+
"then": {
318
+
"$ref": "#/definitions/StreamableHttpTransport"
319
+
}
271
320
},
272
321
{
273
-
"$ref": "#/definitions/SseTransport"
322
+
"if": {
323
+
"properties": {
324
+
"type": {
325
+
"const": "sse"
326
+
}
327
+
}
328
+
},
329
+
"then": {
330
+
"$ref": "#/definitions/SseTransport"
331
+
}
274
332
}
275
333
],
276
-
"description": "Transport protocol configuration for the package"
334
+
"properties": {
335
+
"type": {
336
+
"enum": [
337
+
"stdio",
338
+
"streamable-http",
339
+
"sse"
340
+
],
341
+
"type": "string"
342
+
}
343
+
},
344
+
"required": [
345
+
"type"
346
+
],
347
+
"type": "object"
277
348
},
278
349
"version": {
279
350
"description": "Package version. Must be a specific version. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '\u003e=1.2.3', '1.x', '1.*').",
0 commit comments