diff --git a/packages/parsers/package.json b/packages/parsers/package.json
index 6cea054d75..51d01e6973 100644
--- a/packages/parsers/package.json
+++ b/packages/parsers/package.json
@@ -1,6 +1,6 @@
{
"name": "@fern-api/docs-parsers",
- "version": "0.0.6",
+ "version": "0.0.11",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern-platform.git",
@@ -14,8 +14,9 @@
"type": "module",
"scripts": {
"compile": "tsc --build",
- "clean": "rm -rf dist node_modules",
+ "clean": "rm -rf dist node_modules tsconfig.tsbuildinfo",
"test": "vitest --run --passWithNoTests --globals",
+ "test:update": "vitest -u --run --passWithNoTests --globals",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
@@ -29,6 +30,7 @@
"dependencies": {
"@fern-api/logger": "0.4.24-rc1",
"@fern-api/ui-core-utils": "workspace:*",
+ "es-toolkit": "^1.24.0",
"openapi-types": "^12.1.3",
"ts-essentials": "^10.0.1",
"uuid": "^9.0.0",
diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json b/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json
index d99340bc5d..61af167482 100644
--- a/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json
+++ b/packages/parsers/src/__test__/__snapshots__/openapi/cohere.json
@@ -1,9 +1,9 @@
{
"id": "test-uuid-replacement",
"endpoints": {
- "test-uuid-replacement": {
+ "post-v-1-chat": {
"description": "Generates a text response to a user message.\nTo learn how to use the Chat API and RAG follow our [Text Generation guides](https://docs.cohere.com/docs/chat-api).\n",
- "id": "/v1/chat",
+ "id": "post-v-1-chat",
"method": "POST",
"path": [
{
@@ -28,9 +28,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -39,12 +45,18 @@
{
"key": "Accepts",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "text/event-stream"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "text/event-stream"
+ }
+ ]
}
- ]
+ }
},
"description": "Pass text/event-stream to receive the streamed response as server-sent events. The default is `\\n` delimited events.\n"
}
@@ -73,9 +85,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -86,9 +104,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -99,9 +123,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -112,12 +142,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Message"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Message"
+ }
+ }
}
}
}
@@ -129,9 +165,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -140,18 +182,24 @@
{
"key": "prompt_truncation",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "OFF"
- },
- {
- "value": "AUTO"
- },
- {
- "value": "AUTO_PRESERVE_ORDER"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "OFF"
+ },
+ {
+ "value": "AUTO"
+ },
+ {
+ "value": "AUTO_PRESERVE_ORDER"
+ }
+ ]
}
- ]
+ }
},
"description": "Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases.\n\nDictates how the prompt will be constructed.\n\nWith `prompt_truncation` set to \"AUTO\", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.\n\nWith `prompt_truncation` set to \"AUTO_PRESERVE_ORDER\", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.\n\nWith `prompt_truncation` set to \"OFF\", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.\n\nCompatible Deployments: \n - AUTO: Cohere Platform Only\n - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments\n"
},
@@ -160,12 +208,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatConnector"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatConnector"
+ }
+ }
}
}
}
@@ -177,9 +231,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -190,12 +250,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatDocument"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatDocument"
+ }
+ }
}
}
}
@@ -205,18 +271,24 @@
{
"key": "citation_quality",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "fast"
- },
- {
- "value": "accurate"
- },
- {
- "value": "off"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "fast"
+ },
+ {
+ "value": "accurate"
+ },
+ {
+ "value": "off"
+ }
+ ]
}
- ]
+ }
},
"description": "Defaults to `\"accurate\"`.\n\nDictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `\"accurate\"` results, `\"fast\"` results or no results.\n\nCompatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments\n"
},
@@ -225,11 +297,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0,
- "maximum": 1
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0,
+ "maximum": 1
+ }
+ }
}
}
},
@@ -240,9 +318,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -253,9 +337,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -266,12 +356,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 0,
- "maximum": 500,
- "default": 0
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 500,
+ "default": 0
+ }
+ }
}
}
},
@@ -282,12 +378,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0.01,
- "maximum": 0.99,
- "default": 0.75
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0.01,
+ "maximum": 0.99,
+ "default": 0.75
+ }
+ }
}
}
},
@@ -298,11 +400,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 0,
- "maximum": 18446744073709552000
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 18446744073709552000
+ }
+ }
}
}
},
@@ -313,13 +421,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -332,9 +446,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -345,9 +465,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -358,12 +484,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Tool"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Tool"
+ }
+ }
}
}
}
@@ -375,12 +507,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolResult"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolResult"
+ }
+ }
}
}
}
@@ -392,9 +530,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -405,26 +549,38 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ResponseFormat"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ResponseFormat"
+ }
+ }
}
}
},
{
"key": "safety_mode",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "CONTEXTUAL"
- },
- {
- "value": "STRICT"
- },
- {
- "value": "NONE"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "CONTEXTUAL"
+ },
+ {
+ "value": "STRICT"
+ },
+ {
+ "value": "NONE"
+ }
+ ]
}
- ]
+ }
},
"description": "Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`.\nWhen `NONE` is specified, the safety instruction will be omitted.\n\nSafety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters.\n\n**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release) and newer.\n\nCompatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments\n"
}
@@ -452,7 +608,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -474,7 +630,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -496,7 +652,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -518,7 +674,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -540,7 +696,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -562,7 +718,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -584,7 +740,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -606,7 +762,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -628,7 +784,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -650,7 +806,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -672,7 +828,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -694,14 +850,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-2-chat": {
"description": "Generates a text response to a user message and streams it down, token by token. To learn how to use the Chat API with streaming follow our [Text Generation guides](https://docs.cohere.com/v2/docs/chat-api).\n\nFollow the [Migration Guide](https://docs.cohere.com/v2/docs/migrating-v1-to-v2) for instructions on moving from API v1 to API v2.\n",
- "id": "/v2/chat",
+ "namespace": [
+ "v2"
+ ],
+ "id": "post-v-2-chat",
"method": "POST",
"path": [
{
@@ -726,9 +885,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -769,12 +934,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolV2"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolV2"
+ }
+ }
}
}
}
@@ -786,9 +957,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -799,10 +976,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
- "type": "undiscriminatedUnion",
- "variants": []
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "list",
+ "itemShape": {
+ "type": "undiscriminatedUnion",
+ "variants": []
+ }
+ }
}
}
},
@@ -813,8 +996,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "CitationOptions"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "CitationOptions"
+ }
+ }
}
}
},
@@ -823,26 +1012,38 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ResponseFormatV2"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ResponseFormatV2"
+ }
+ }
}
}
},
{
"key": "safety_mode",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "CONTEXTUAL"
- },
- {
- "value": "STRICT"
- },
- {
- "value": "OFF"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "CONTEXTUAL"
+ },
+ {
+ "value": "STRICT"
+ },
+ {
+ "value": "OFF"
+ }
+ ]
}
- ]
+ }
},
"description": "Used to select the [safety instruction](https://docs.cohere.com/v2/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`.\nWhen `OFF` is specified, the safety instruction will be omitted.\n\nSafety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters.\n\n**Note**: This parameter is only compatible with models [Command R 08-2024](https://docs.cohere.com/v2/docs/command-r#august-2024-release), [Command R+ 08-2024](https://docs.cohere.com/v2/docs/command-r-plus#august-2024-release) and newer.\n"
},
@@ -851,9 +1052,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -864,13 +1071,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -883,11 +1096,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0,
- "maximum": 1
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0,
+ "maximum": 1
+ }
+ }
}
}
},
@@ -898,11 +1117,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 0,
- "maximum": 18446744073709552000
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 18446744073709552000
+ }
+ }
}
}
},
@@ -913,9 +1138,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -926,9 +1157,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -939,12 +1176,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0,
- "maximum": 500,
- "default": 0
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0,
+ "maximum": 500,
+ "default": 0
+ }
+ }
}
}
},
@@ -955,12 +1198,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0.01,
- "maximum": 0.99,
- "default": 0.75
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0.01,
+ "maximum": 0.99,
+ "default": 0.75
+ }
+ }
}
}
},
@@ -971,9 +1220,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -1003,7 +1258,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -1025,7 +1280,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -1047,7 +1302,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -1069,7 +1324,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -1091,7 +1346,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -1113,7 +1368,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -1135,7 +1390,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -1157,7 +1412,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -1179,7 +1434,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -1201,7 +1456,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -1223,7 +1478,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -1245,14 +1500,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-generate": {
"description": "\nThis API is marked as \"Legacy\" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.\n\nGenerates realistic text conditioned on a given input.\n",
- "id": "/v1/generate",
+ "id": "post-v-1-generate",
"method": "POST",
"path": [
{
@@ -1277,9 +1532,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -1292,9 +1553,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -1325,9 +1592,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -1338,9 +1611,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -1351,9 +1630,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -1364,9 +1649,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -1375,19 +1666,26 @@
{
"key": "truncate",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "NONE"
- },
- {
- "value": "START"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "NONE"
+ },
+ {
+ "value": "START"
+ },
+ {
+ "value": "END"
+ }
+ ],
+ "default": "END"
},
- {
- "value": "END"
- }
- ],
- "default": "END"
+ "default": "END"
+ }
},
"description": "One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.\n\nPassing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.\n\nIf `NONE` is selected, when the input exceeds the maximum input token length an error will be returned."
},
@@ -1396,9 +1694,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -1409,11 +1713,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 0,
- "maximum": 18446744073709552000
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 18446744073709552000
+ }
+ }
}
}
},
@@ -1424,9 +1734,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -1437,13 +1753,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -1456,13 +1778,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -1475,9 +1803,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -1488,9 +1822,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -1501,9 +1841,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -1514,9 +1860,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -1525,19 +1877,26 @@
{
"key": "return_likelihoods",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "GENERATION"
- },
- {
- "value": "ALL"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "GENERATION"
+ },
+ {
+ "value": "ALL"
+ },
+ {
+ "value": "NONE"
+ }
+ ],
+ "default": "NONE"
},
- {
- "value": "NONE"
- }
- ],
- "default": "NONE"
+ "default": "NONE"
+ }
},
"description": "One of `GENERATION|ALL|NONE` to specify how and if the token likelihoods are returned with the response. Defaults to `NONE`.\n\nIf `GENERATION` is selected, the token likelihoods will only be provided for generated text.\n\nIf `ALL` is selected, the token likelihoods will be provided both for the prompt and the generated text."
},
@@ -1546,9 +1905,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -1589,7 +1954,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -1611,7 +1976,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -1633,7 +1998,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -1655,7 +2020,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -1677,7 +2042,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -1699,7 +2064,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -1721,7 +2086,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -1743,7 +2108,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -1765,7 +2130,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -1787,7 +2152,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -1809,7 +2174,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -1831,14 +2196,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-embed": {
"description": "This endpoint returns text and image embeddings. An embedding is a list of floating point numbers that captures semantic information about the content that it represents.\n\nEmbeddings can be used to create classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.\n\nIf you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](https://docs.cohere.com/docs/semantic-search).",
- "id": "/v1/embed",
+ "id": "post-v-1-embed",
"method": "POST",
"path": [
{
@@ -1863,9 +2228,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -1999,7 +2370,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -2021,7 +2392,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -2043,7 +2414,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -2065,7 +2436,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -2087,7 +2458,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -2109,7 +2480,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -2131,7 +2502,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -2153,7 +2524,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -2175,7 +2546,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -2197,7 +2568,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -2219,7 +2590,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -2241,14 +2612,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-2-embed": {
"description": "This endpoint returns text embeddings. An embedding is a list of floating point numbers that captures semantic information about the text that it represents.\n\nEmbeddings can be used to create text classifiers as well as empower semantic search. To learn more about embeddings, see the embedding page.\n\nIf you want to learn more how to use the embedding model, have a look at the [Semantic Search Guide](https://docs.cohere.com/docs/semantic-search).",
- "id": "/v2/embed",
+ "namespace": [
+ "v2"
+ ],
+ "id": "post-v-2-embed",
"method": "POST",
"path": [
{
@@ -2273,9 +2647,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -2288,9 +2668,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -2308,13 +2694,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -2327,13 +2719,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -2384,19 +2782,26 @@
{
"key": "truncate",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "NONE"
- },
- {
- "value": "START"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "NONE"
+ },
+ {
+ "value": "START"
+ },
+ {
+ "value": "END"
+ }
+ ],
+ "default": "END"
},
- {
- "value": "END"
- }
- ],
- "default": "END"
+ "default": "END"
+ }
},
"description": "One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.\n\nPassing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.\n\nIf `NONE` is selected, when the input exceeds the maximum input token length an error will be returned."
}
@@ -2435,7 +2840,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -2457,7 +2862,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -2479,7 +2884,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -2501,7 +2906,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -2523,7 +2928,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -2545,7 +2950,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -2567,7 +2972,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -2589,7 +2994,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -2611,7 +3016,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -2633,7 +3038,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -2655,7 +3060,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -2677,14 +3082,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-embed-jobs": {
"description": "The list embed job endpoint allows users to view all embed jobs history for that specific user.",
- "id": "/v1/embed-jobs",
+ "namespace": [
+ "embed-jobs"
+ ],
+ "id": "get-v-1-embed-jobs",
"method": "GET",
"path": [
{
@@ -2709,9 +3117,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -2724,9 +3138,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -2765,7 +3185,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -2787,7 +3207,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -2809,7 +3229,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -2831,7 +3251,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -2853,7 +3273,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -2875,7 +3295,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -2897,7 +3317,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -2919,7 +3339,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -2941,7 +3361,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -2963,7 +3383,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -2985,7 +3405,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -3007,14 +3427,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-embed-jobs": {
"description": "This API launches an async Embed job for a [Dataset](https://docs.cohere.com/docs/datasets) of type `embed-input`. The result of a completed embed job is new Dataset of type `embed-output`, which contains the original text entries and the corresponding embeddings.",
- "id": "/v1/embed-jobs",
+ "namespace": [
+ "embed-jobs"
+ ],
+ "id": "post-v-1-embed-jobs",
"method": "POST",
"path": [
{
@@ -3039,9 +3462,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -3054,9 +3483,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -3105,7 +3540,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -3127,7 +3562,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -3149,7 +3584,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -3171,7 +3606,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -3193,7 +3628,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -3215,7 +3650,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -3237,7 +3672,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -3259,7 +3694,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -3281,7 +3716,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -3303,7 +3738,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -3325,7 +3760,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -3347,14 +3782,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-embed-jobs-id": {
"description": "This API retrieves the details about an embed job started by the same user.",
- "id": "/v1/embed-jobs/{id}",
+ "namespace": [
+ "embed-jobs"
+ ],
+ "id": "get-v-1-embed-jobs-id",
"method": "GET",
"path": [
{
@@ -3398,9 +3836,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -3413,9 +3857,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -3454,7 +3904,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -3476,7 +3926,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -3498,7 +3948,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -3520,7 +3970,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -3542,7 +3992,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -3564,7 +4014,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -3586,7 +4036,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -3608,7 +4058,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -3630,7 +4080,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -3652,7 +4102,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -3674,7 +4124,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -3696,14 +4146,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-embed-jobs-id-cancel": {
"description": "This API allows users to cancel an active embed job. Once invoked, the embedding process will be terminated, and users will be charged for the embeddings processed up to the cancellation point. It's important to note that partial results will not be available to users after cancellation.",
- "id": "/v1/embed-jobs/{id}/cancel",
+ "namespace": [
+ "embed-jobs"
+ ],
+ "id": "post-v-1-embed-jobs-id-cancel",
"method": "POST",
"path": [
{
@@ -3751,9 +4204,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -3781,7 +4240,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -3803,7 +4262,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -3825,7 +4284,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -3847,7 +4306,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -3869,7 +4328,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -3891,7 +4350,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -3913,7 +4372,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -3935,7 +4394,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -3957,7 +4416,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -3979,7 +4438,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -4001,7 +4460,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -4023,14 +4482,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-rerank": {
"description": "This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.",
- "id": "/v1/rerank",
+ "id": "post-v-1-rerank",
"method": "POST",
"path": [
{
@@ -4055,9 +4514,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -4075,9 +4540,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -4115,10 +4586,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 1
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 1
+ }
+ }
}
}
},
@@ -4129,13 +4606,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -4148,10 +4631,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean",
- "default": false
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean",
+ "default": false
+ }
+ }
}
}
},
@@ -4162,10 +4651,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "default": 10
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "default": 10
+ }
+ }
}
}
},
@@ -4185,9 +4680,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -4205,23 +4706,29 @@
{
"key": "document",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": [
- {
- "key": "text",
- "valueShape": {
- "type": "alias",
- "value": {
- "type": "primitive",
- "value": {
- "type": "string"
- }
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": [
+ {
+ "key": "text",
+ "valueShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
+ },
+ "description": "The text of the document to rerank"
}
- },
- "description": "The text of the document to rerank"
+ ]
}
- ]
+ }
},
"description": "If `return_documents` is set as `false` this will return none, if `true` it will return the documents passed in"
},
@@ -4262,8 +4769,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -4292,7 +4805,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -4314,7 +4827,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -4336,7 +4849,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -4358,7 +4871,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -4380,7 +4893,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -4402,7 +4915,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -4424,7 +4937,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -4446,7 +4959,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -4468,7 +4981,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -4490,7 +5003,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -4512,7 +5025,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -4534,14 +5047,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-2-rerank": {
"description": "This endpoint takes in a query and a list of texts and produces an ordered array with each text assigned a relevance score.",
- "id": "/v2/rerank",
+ "namespace": [
+ "v2"
+ ],
+ "id": "post-v-2-rerank",
"method": "POST",
"path": [
{
@@ -4566,9 +5082,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -4631,10 +5153,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 1
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 1
+ }
+ }
}
}
},
@@ -4645,9 +5173,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -4667,9 +5201,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -4721,8 +5261,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -4751,7 +5297,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -4773,7 +5319,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -4795,7 +5341,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -4817,7 +5363,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -4839,7 +5385,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -4861,7 +5407,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -4883,7 +5429,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -4905,7 +5451,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -4927,7 +5473,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -4949,7 +5495,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -4971,7 +5517,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -4993,14 +5539,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-classify": {
"description": "This endpoint makes a prediction about which label fits the specified text inputs best. To make a prediction, Classify uses the provided `examples` of text + label pairs as a reference.\nNote: [Fine-tuned models](https://docs.cohere.com/docs/classify-fine-tuning) trained on classification examples don't require the `examples` parameter to be passed in explicitly.",
- "id": "/v1/classify",
+ "id": "post-v-1-classify",
"method": "POST",
"path": [
{
@@ -5025,9 +5571,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5040,9 +5592,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5079,12 +5637,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ClassifyExample"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ClassifyExample"
+ }
+ }
}
}
}
@@ -5096,9 +5660,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5109,9 +5679,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5120,19 +5696,26 @@
{
"key": "truncate",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "NONE"
- },
- {
- "value": "START"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "NONE"
+ },
+ {
+ "value": "START"
+ },
+ {
+ "value": "END"
+ }
+ ],
+ "default": "END"
},
- {
- "value": "END"
- }
- ],
- "default": "END"
+ "default": "END"
+ }
},
"description": "One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length.\nPassing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.\nIf `NONE` is selected, when the input exceeds the maximum input token length an error will be returned."
}
@@ -5184,9 +5767,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5197,9 +5786,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5230,9 +5825,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -5292,8 +5893,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -5322,7 +5929,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -5344,7 +5951,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -5366,7 +5973,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -5388,7 +5995,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -5410,7 +6017,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -5432,7 +6039,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -5454,7 +6061,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -5476,7 +6083,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -5498,7 +6105,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -5520,7 +6127,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -5542,7 +6149,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -5564,14 +6171,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-datasets": {
"description": "List datasets that have been created.",
- "id": "/v1/datasets",
+ "namespace": [
+ "datasets"
+ ],
+ "id": "get-v-1-datasets",
"method": "GET",
"path": [
{
@@ -5596,9 +6206,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5609,9 +6225,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -5622,9 +6244,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -5635,9 +6263,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -5648,9 +6282,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -5661,8 +6301,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "DatasetValidationStatus"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "DatasetValidationStatus"
+ }
+ }
}
},
"description": "optional filter by validation status"
@@ -5674,9 +6320,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -5730,7 +6382,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -5752,7 +6404,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -5774,7 +6426,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -5796,7 +6448,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -5818,7 +6470,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -5840,7 +6492,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -5862,7 +6514,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -5884,7 +6536,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -5906,7 +6558,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -5928,7 +6580,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -5950,7 +6602,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -5972,14 +6624,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-datasets": {
"description": "Create a dataset by uploading a file. See ['Dataset Creation'](https://docs.cohere.com/docs/datasets#dataset-creation) for more information.",
- "id": "/v1/datasets",
+ "namespace": [
+ "datasets"
+ ],
+ "id": "post-v-1-datasets",
"method": "POST",
"path": [
{
@@ -6028,9 +6683,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -6041,9 +6702,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -6054,13 +6721,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -6073,13 +6746,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -6092,9 +6771,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -6105,9 +6790,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -6120,9 +6811,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -6193,7 +6890,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -6215,7 +6912,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -6237,7 +6934,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -6259,7 +6956,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -6281,7 +6978,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -6303,7 +7000,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -6325,7 +7022,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -6347,7 +7044,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -6369,7 +7066,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -6391,7 +7088,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -6413,7 +7110,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -6435,14 +7132,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-datasets-usage": {
"description": "View the dataset storage usage for your Organization. Each Organization can have up to 10GB of storage across all their users.",
- "id": "/v1/datasets/usage",
+ "namespace": [
+ "datasets"
+ ],
+ "id": "get-v-1-datasets-usage",
"method": "GET",
"path": [
{
@@ -6471,9 +7171,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -6524,7 +7230,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -6546,7 +7252,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -6568,7 +7274,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -6590,7 +7296,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -6612,7 +7318,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -6634,7 +7340,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -6656,7 +7362,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -6678,7 +7384,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -6700,7 +7406,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -6722,7 +7428,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -6744,7 +7450,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -6766,14 +7472,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-datasets-id": {
"description": "Retrieve a dataset by ID. See ['Datasets'](https://docs.cohere.com/docs/datasets) for more information.",
- "id": "/v1/datasets/{id}",
+ "namespace": [
+ "datasets"
+ ],
+ "id": "get-v-1-datasets-id",
"method": "GET",
"path": [
{
@@ -6816,9 +7525,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -6866,7 +7581,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -6888,7 +7603,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -6910,7 +7625,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -6932,7 +7647,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -6954,7 +7669,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -6976,7 +7691,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -6998,7 +7713,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -7020,7 +7735,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -7042,7 +7757,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -7064,7 +7779,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -7086,7 +7801,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -7108,14 +7823,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "delete-v-1-datasets-id": {
"description": "Delete a dataset by ID. Datasets are automatically deleted after 30 days, but they can also be deleted manually.",
- "id": "/v1/datasets/{id}",
+ "namespace": [
+ "datasets"
+ ],
+ "id": "delete-v-1-datasets-id",
"method": "DELETE",
"path": [
{
@@ -7158,9 +7876,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7197,7 +7921,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -7219,7 +7943,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -7241,7 +7965,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -7263,7 +7987,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -7285,7 +8009,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -7307,7 +8031,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -7329,7 +8053,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -7351,7 +8075,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -7373,7 +8097,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -7395,7 +8119,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -7417,7 +8141,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -7439,14 +8163,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-summarize": {
"description": "\nThis API is marked as \"Legacy\" and is no longer maintained. Follow the [migration guide](https://docs.cohere.com/docs/migrating-from-cogenerate-to-cochat) to start using the Chat API.\n\nGenerates a summary in English for a given text.\n",
- "id": "/v1/summarize",
+ "id": "post-v-1-summarize",
"method": "POST",
"path": [
{
@@ -7471,9 +8195,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7486,9 +8216,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7517,35 +8253,49 @@
{
"key": "length",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "short"
- },
- {
- "value": "medium"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "short"
+ },
+ {
+ "value": "medium"
+ },
+ {
+ "value": "long"
+ }
+ ],
+ "default": "medium"
},
- {
- "value": "long"
- }
- ],
- "default": "medium"
+ "default": "medium"
+ }
},
"description": "One of `short`, `medium`, `long`, or `auto` defaults to `auto`. Indicates the approximate length of the summary. If `auto` is selected, the best option will be picked based on the input text."
},
{
"key": "format",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "paragraph"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "paragraph"
+ },
+ {
+ "value": "bullets"
+ }
+ ],
+ "default": "paragraph"
},
- {
- "value": "bullets"
- }
- ],
- "default": "paragraph"
+ "default": "paragraph"
+ }
},
"description": "One of `paragraph`, `bullets`, or `auto`, defaults to `auto`. Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If `auto` is selected, the best option will be picked based on the input text."
},
@@ -7554,9 +8304,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7565,19 +8321,26 @@
{
"key": "extractiveness",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "low"
- },
- {
- "value": "medium"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "low"
+ },
+ {
+ "value": "medium"
+ },
+ {
+ "value": "high"
+ }
+ ],
+ "default": "low"
},
- {
- "value": "high"
- }
- ],
- "default": "low"
+ "default": "low"
+ }
},
"description": "One of `low`, `medium`, `high`, or `auto`, defaults to `auto`. Controls how close to the original text the summary is. `high` extractiveness summaries will lean towards reusing sentences verbatim, while `low` extractiveness summaries will tend to paraphrase more. If `auto` is selected, the best option will be picked based on the input text."
},
@@ -7586,12 +8349,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "minimum": 0,
- "maximum": 5,
- "default": 0.3
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "minimum": 0,
+ "maximum": 5,
+ "default": 0.3
+ }
+ }
}
}
},
@@ -7602,9 +8371,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7680,7 +8455,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -7702,7 +8477,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -7724,7 +8499,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -7746,7 +8521,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -7768,7 +8543,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -7790,7 +8565,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -7812,7 +8587,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -7834,7 +8609,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -7856,7 +8631,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -7878,7 +8653,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -7900,7 +8675,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -7922,14 +8697,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-tokenize": {
"description": "This endpoint splits input text into smaller units called tokens using byte-pair encoding (BPE). To learn more about tokenization and byte pair encoding, see the tokens page.",
- "id": "/v1/tokenize",
+ "id": "post-v-1-tokenize",
"method": "POST",
"path": [
{
@@ -7954,9 +8729,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -7969,9 +8750,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -8061,8 +8848,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -8091,7 +8884,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -8113,7 +8906,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -8135,7 +8928,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -8157,7 +8950,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -8179,7 +8972,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -8201,7 +8994,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -8223,7 +9016,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -8245,7 +9038,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -8267,7 +9060,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -8289,7 +9082,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -8311,7 +9104,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -8333,14 +9126,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-detokenize": {
"description": "This endpoint takes tokens using byte-pair encoding and returns their text representation. To learn more about tokenization and byte pair encoding, see the tokens page.",
- "id": "/v1/detokenize",
+ "id": "post-v-1-detokenize",
"method": "POST",
"path": [
{
@@ -8365,9 +9158,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -8380,9 +9179,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -8454,8 +9259,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -8484,7 +9295,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -8506,7 +9317,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -8528,7 +9339,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -8550,7 +9361,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -8572,7 +9383,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -8594,7 +9405,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -8616,7 +9427,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -8638,7 +9449,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -8660,7 +9471,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -8682,7 +9493,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -8704,7 +9515,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -8726,14 +9537,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-connectors": {
"description": "Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.",
- "id": "/v1/connectors",
+ "namespace": [
+ "connectors"
+ ],
+ "id": "get-v-1-connectors",
"method": "GET",
"path": [
{
@@ -8758,10 +9572,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "default": 30
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "default": 30
+ }
+ }
}
}
},
@@ -8772,10 +9592,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double",
- "default": 0
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double",
+ "default": 0
+ }
+ }
}
}
},
@@ -8788,9 +9614,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -8829,7 +9661,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -8851,7 +9683,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -8873,7 +9705,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -8895,7 +9727,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -8917,7 +9749,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -8939,7 +9771,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -8961,7 +9793,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -8983,7 +9815,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -9005,7 +9837,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -9027,7 +9859,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -9049,7 +9881,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -9071,14 +9903,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-connectors": {
"description": "Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information.",
- "id": "/v1/connectors",
+ "namespace": [
+ "connectors"
+ ],
+ "id": "post-v-1-connectors",
"method": "POST",
"path": [
{
@@ -9103,9 +9938,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -9154,7 +9995,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -9176,7 +10017,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -9198,7 +10039,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -9220,7 +10061,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -9242,7 +10083,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -9264,7 +10105,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -9286,7 +10127,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -9308,7 +10149,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -9330,7 +10171,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -9352,7 +10193,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -9374,7 +10215,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -9396,14 +10237,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-connectors-id": {
"description": "Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.",
- "id": "/v1/connectors/{id}",
+ "namespace": [
+ "connectors"
+ ],
+ "id": "get-v-1-connectors-id",
"method": "GET",
"path": [
{
@@ -9447,9 +10291,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -9488,7 +10338,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -9510,7 +10360,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -9532,7 +10382,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -9554,7 +10404,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -9576,7 +10426,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -9598,7 +10448,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -9620,7 +10470,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -9642,7 +10492,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -9664,7 +10514,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -9686,7 +10536,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -9708,7 +10558,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -9730,14 +10580,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "delete-v-1-connectors-id": {
"description": "Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.",
- "id": "/v1/connectors/{id}",
+ "namespace": [
+ "connectors"
+ ],
+ "id": "delete-v-1-connectors-id",
"method": "DELETE",
"path": [
{
@@ -9781,9 +10634,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -9822,7 +10681,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -9844,7 +10703,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -9866,7 +10725,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -9888,7 +10747,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -9910,7 +10769,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -9932,7 +10791,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -9954,7 +10813,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -9976,7 +10835,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -9998,7 +10857,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -10020,7 +10879,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -10042,7 +10901,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -10064,14 +10923,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-connectors-id-oauth-authorize": {
"description": "Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.",
- "id": "/v1/connectors/{id}/oauth/authorize",
+ "namespace": [
+ "connectors"
+ ],
+ "id": "post-v-1-connectors-id-oauth-authorize",
"method": "POST",
"path": [
{
@@ -10123,9 +10985,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -10138,9 +11006,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -10179,7 +11053,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -10201,7 +11075,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -10223,7 +11097,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -10245,7 +11119,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -10267,7 +11141,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -10289,7 +11163,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -10311,7 +11185,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -10333,7 +11207,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -10355,7 +11229,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -10377,7 +11251,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -10399,7 +11273,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -10421,14 +11295,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-models-model": {
"description": "Returns the details of a model, provided its name.",
- "id": "/v1/models/{model}",
+ "namespace": [
+ "models"
+ ],
+ "id": "get-v-1-models-model",
"method": "GET",
"path": [
{
@@ -10471,9 +11348,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -10486,9 +11369,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -10527,7 +11416,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -10549,7 +11438,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -10571,7 +11460,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -10593,7 +11482,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -10615,7 +11504,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -10637,7 +11526,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -10659,7 +11548,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -10681,7 +11570,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -10703,7 +11592,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -10725,7 +11614,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -10747,7 +11636,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -10769,14 +11658,17 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-models": {
"description": "Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.",
- "id": "/v1/models",
+ "namespace": [
+ "models"
+ ],
+ "id": "get-v-1-models",
"method": "GET",
"path": [
{
@@ -10801,9 +11693,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -10814,9 +11712,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -10827,8 +11731,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "CompatibleEndpoint"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "CompatibleEndpoint"
+ }
+ }
}
},
"description": "When provided, filters the list of models to only those that are compatible with the specified endpoint."
@@ -10838,9 +11748,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -10879,7 +11795,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -10901,7 +11817,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -10923,7 +11839,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -10945,7 +11861,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -10967,7 +11883,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -10989,7 +11905,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -11011,7 +11927,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -11033,7 +11949,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -11055,7 +11971,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -11077,7 +11993,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -11099,7 +12015,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -11121,14 +12037,14 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-check-api-key": {
"description": "Checks that the api key in the Authorization header is valid and active\n",
- "id": "/v1/check-api-key",
+ "id": "post-v-1-check-api-key",
"method": "POST",
"path": [
{
@@ -11153,9 +12069,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11185,9 +12107,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -11197,9 +12125,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -11229,7 +12163,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -11251,7 +12185,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -11273,7 +12207,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -11295,7 +12229,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 422,
@@ -11317,7 +12251,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Unprocessable Entity"
},
{
"statusCode": 429,
@@ -11339,7 +12273,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Too Many Requests"
},
{
"statusCode": 498,
@@ -11361,7 +12295,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 499,
@@ -11383,7 +12317,7 @@
}
]
},
- "name": "dummy error"
+ "name": "UNKNOWN ERROR"
},
{
"statusCode": 500,
@@ -11405,7 +12339,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 501,
@@ -11427,7 +12361,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Not Implemented"
},
{
"statusCode": 503,
@@ -11449,7 +12383,7 @@
}
]
},
- "name": "dummy error"
+ "name": "Service Unavailable"
},
{
"statusCode": 504,
@@ -11471,13 +12405,16 @@
}
]
},
- "name": "dummy error"
+ "name": "Gateway Timeout"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models",
+ "get-v-1-finetuning-finetuned-models": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "get-v-1-finetuning-finetuned-models",
"method": "GET",
"path": [
{
@@ -11506,9 +12443,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -11519,9 +12462,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11532,9 +12481,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11547,9 +12502,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11578,7 +12539,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -11590,7 +12551,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -11602,7 +12563,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -11614,7 +12575,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -11626,7 +12587,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -11638,13 +12599,16 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models",
+ "post-v-1-finetuning-finetuned-models": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "post-v-1-finetuning-finetuned-models",
"method": "POST",
"path": [
{
@@ -11673,9 +12637,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11714,7 +12684,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -11726,7 +12696,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -11738,7 +12708,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -11750,7 +12720,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -11762,7 +12732,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -11774,13 +12744,16 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models/{id}",
+ "get-v-1-finetuning-finetuned-models-id": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "get-v-1-finetuning-finetuned-models-id",
"method": "GET",
"path": [
{
@@ -11828,9 +12801,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -11859,7 +12838,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -11871,7 +12850,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -11883,7 +12862,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -11895,7 +12874,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -11907,7 +12886,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -11919,13 +12898,16 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models/{id}",
+ "delete-v-1-finetuning-finetuned-models-id": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "delete-v-1-finetuning-finetuned-models-id",
"method": "DELETE",
"path": [
{
@@ -11973,9 +12955,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12004,7 +12992,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -12016,7 +13004,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -12028,7 +13016,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -12040,7 +13028,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -12052,7 +13040,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -12064,13 +13052,16 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models/{finetuned_model_id}/events",
+ "get-v-1-finetuning-finetuned-models-finetuned-model-id-events": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "get-v-1-finetuning-finetuned-models-finetuned-model-id-events",
"method": "GET",
"path": [
{
@@ -12122,9 +13113,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -12135,9 +13132,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12148,9 +13151,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12163,9 +13172,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12194,7 +13209,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -12206,7 +13221,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -12218,7 +13233,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -12230,7 +13245,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -12242,7 +13257,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -12254,13 +13269,16 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
},
- "test-uuid-replacement": {
- "id": "/v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics",
+ "get-v-1-finetuning-finetuned-models-finetuned-model-id-training-step-metrics": {
+ "namespace": [
+ "finetuning"
+ ],
+ "id": "get-v-1-finetuning-finetuned-models-finetuned-model-id-training-step-metrics",
"method": "GET",
"path": [
{
@@ -12312,9 +13330,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -12325,9 +13349,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12340,9 +13370,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12371,7 +13407,7 @@
}
},
"description": "Bad Request",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 401,
@@ -12383,7 +13419,7 @@
}
},
"description": "Unauthorized",
- "name": "dummy error"
+ "name": "Unauthorized"
},
{
"statusCode": 403,
@@ -12395,7 +13431,7 @@
}
},
"description": "Forbidden",
- "name": "dummy error"
+ "name": "Forbidden"
},
{
"statusCode": 404,
@@ -12407,7 +13443,7 @@
}
},
"description": "Not Found",
- "name": "dummy error"
+ "name": "Not Found"
},
{
"statusCode": 500,
@@ -12419,7 +13455,7 @@
}
},
"description": "Internal Server Error",
- "name": "dummy error"
+ "name": "Internal Server Error"
},
{
"statusCode": 503,
@@ -12431,7 +13467,7 @@
}
},
"description": "Status Service Unavailable",
- "name": "dummy error"
+ "name": "Service Unavailable"
}
],
"examples": []
@@ -12527,12 +13563,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCall"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCall"
+ }
+ }
}
}
}
@@ -12596,12 +13638,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolResult"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolResult"
+ }
+ }
}
}
}
@@ -12651,12 +13699,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCall"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCall"
+ }
+ }
}
}
}
@@ -12698,12 +13752,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCall"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCall"
+ }
+ }
}
}
}
@@ -12745,12 +13805,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCall"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCall"
+ }
+ }
}
}
}
@@ -12779,12 +13845,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolResult"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolResult"
+ }
+ }
}
}
}
@@ -12819,9 +13891,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -12832,9 +13910,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -12843,9 +13927,15 @@
{
"key": "options",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "Provides the connector with different settings at request time. The key/value pairs of this object are specific to each connector.\n\nFor example, the connector `web-search` supports the `site` option, which limits search results to the specified domain.\n"
}
@@ -12917,9 +14007,15 @@
{
"key": "parameter_definitions",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "The input parameters of the tool. Accepts a dictionary where the key is the name of the parameter and the value is the parameter spec. Valid parameter names contain only the characters `a-z`, `A-Z`, `0-9`, `_` and must not begin with a digit.\n```\n{\n \"my_param\": {\n \"description\": ,\n \"type\": , // any python data type, such as 'str', 'bool'\n \"required\": \n }\n}\n```\n"
}
@@ -12979,9 +14075,15 @@
{
"key": "schema",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "A JSON schema object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](https://docs.cohere.com/docs/structured-outputs-json#schema-constraints) for more information.\nExample (required name and age object):\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n```\n\n**Note**: This field must not be specified when the `type` is set to `\"text\"`.\n"
}
@@ -13029,9 +14131,15 @@
{
"key": "schema",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "A JSON schema object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](https://docs.cohere.com/docs/structured-outputs-json#schema-constraints) for more information.\nExample (required name and age object):\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n```\n\n**Note**: This field must not be specified when the `type` is set to `\"text\"`.\n"
}
@@ -13179,8 +14287,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatSearchQuery"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatSearchQuery"
+ }
+ }
}
}
},
@@ -13219,9 +14333,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -13232,9 +14352,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -13301,9 +14427,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
}
@@ -13313,9 +14445,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
}
@@ -13477,9 +14615,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "uuid"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "uuid"
+ }
+ }
}
}
},
@@ -13490,9 +14634,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "uuid"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "uuid"
+ }
+ }
}
}
},
@@ -13503,12 +14653,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatCitation"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatCitation"
+ }
+ }
}
}
}
@@ -13520,12 +14676,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatDocument"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatDocument"
+ }
+ }
}
}
}
@@ -13537,9 +14699,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -13550,12 +14718,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatSearchQuery"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatSearchQuery"
+ }
+ }
}
}
}
@@ -13567,12 +14741,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ChatSearchResult"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ChatSearchResult"
+ }
+ }
}
}
}
@@ -13584,8 +14764,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "FinishReason"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "FinishReason"
+ }
+ }
}
}
},
@@ -13594,12 +14780,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCall"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCall"
+ }
+ }
}
}
}
@@ -13610,12 +14802,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Message"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Message"
+ }
+ }
}
}
}
@@ -13627,8 +14825,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -14291,12 +15495,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCallV2"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCallV2"
+ }
+ }
}
}
}
@@ -14307,9 +15517,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -14318,8 +15534,14 @@
{
"key": "content",
"valueShape": {
- "type": "undiscriminatedUnion",
- "variants": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "undiscriminatedUnion",
+ "variants": []
+ }
+ }
}
},
{
@@ -14327,12 +15549,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Citation"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Citation"
+ }
+ }
}
}
}
@@ -14396,9 +15624,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -14606,12 +15840,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCallV2"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCallV2"
+ }
+ }
}
}
}
@@ -14622,9 +15862,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -14633,8 +15879,14 @@
{
"key": "content",
"valueShape": {
- "type": "undiscriminatedUnion",
- "variants": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "undiscriminatedUnion",
+ "variants": []
+ }
+ }
}
},
{
@@ -14642,12 +15894,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Citation"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Citation"
+ }
+ }
}
}
}
@@ -14888,9 +16146,15 @@
{
"key": "json_schema",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "A [JSON schema](https://json-schema.org/overview/what-is-jsonschema) object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](https://docs.cohere.com/docs/structured-outputs-json#schema-constraints) for more information.\nExample (required name and age object):\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n```\n\n**Note**: This field must not be specified when the `type` is set to `\"text\"`.\n"
}
@@ -14938,9 +16202,15 @@
{
"key": "json_schema",
"valueShape": {
- "type": "object",
- "extends": [],
- "properties": []
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "object",
+ "extends": [],
+ "properties": []
+ }
+ }
},
"description": "A [JSON schema](https://json-schema.org/overview/what-is-jsonschema) object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide](https://docs.cohere.com/docs/structured-outputs-json#schema-constraints) for more information.\nExample (required name and age object):\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"age\": {\"type\": \"integer\"}\n },\n \"required\": [\"name\", \"age\"]\n}\n```\n\n**Note**: This field must not be specified when the `type` is set to `\"text\"`.\n"
}
@@ -14996,12 +16266,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ToolCallV2"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ToolCallV2"
+ }
+ }
}
}
}
@@ -15012,9 +16288,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -15025,43 +16307,49 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
- "type": "discriminatedUnion",
- "discriminant": "type",
- "variants": [
- {
- "discriminantValue": "text",
- "description": "Text content of the message.",
- "type": "object",
- "extends": [],
- "properties": [
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "list",
+ "itemShape": {
+ "type": "discriminatedUnion",
+ "discriminant": "type",
+ "variants": [
{
- "key": "type",
- "valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "text"
+ "discriminantValue": "text",
+ "description": "Text content of the message.",
+ "type": "object",
+ "extends": [],
+ "properties": [
+ {
+ "key": "type",
+ "valueShape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "text"
+ }
+ ]
}
- ]
- }
- },
- {
- "key": "text",
- "valueShape": {
- "type": "alias",
- "value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ },
+ {
+ "key": "text",
+ "valueShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
- }
+ ]
}
]
}
- ]
+ }
}
}
}
@@ -15071,12 +16359,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Citation"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Citation"
+ }
+ }
}
}
}
@@ -15202,9 +16496,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -15234,13 +16534,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
}
@@ -15295,8 +16601,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Usage"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Usage"
+ }
+ }
}
}
},
@@ -15305,12 +16617,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "LogprobItem"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "LogprobItem"
+ }
+ }
}
}
}
@@ -15643,9 +16961,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -15656,9 +16980,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
}
@@ -15668,36 +16998,42 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
- "type": "object",
- "extends": [],
- "properties": [
- {
- "key": "token",
- "valueShape": {
- "type": "alias",
- "value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "list",
+ "itemShape": {
+ "type": "object",
+ "extends": [],
+ "properties": [
+ {
+ "key": "token",
+ "valueShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
- }
- }
- },
- {
- "key": "likelihood",
- "valueShape": {
- "type": "alias",
- "value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ },
+ {
+ "key": "likelihood",
+ "valueShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
- }
+ ]
}
- ]
+ }
}
}
},
@@ -15729,9 +17065,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -15759,8 +17101,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -15839,9 +17187,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -16031,15 +17385,21 @@
{
"key": "response_type",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "embeddings_floats"
- },
- {
- "value": "embeddings_by_type"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "embeddings_floats"
+ },
+ {
+ "value": "embeddings_by_type"
+ }
+ ]
}
- ]
+ }
}
},
{
@@ -16103,12 +17463,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Image"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Image"
+ }
+ }
}
}
}
@@ -16120,8 +17486,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -16137,15 +17509,21 @@
{
"key": "response_type",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "embeddings_floats"
- },
- {
- "value": "embeddings_by_type"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "embeddings_floats"
+ },
+ {
+ "value": "embeddings_by_type"
+ }
+ ]
}
- ]
+ }
}
},
{
@@ -16319,12 +17697,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Image"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Image"
+ }
+ }
}
}
}
@@ -16336,8 +17720,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -16368,9 +17758,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -16431,9 +17827,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -16472,8 +17874,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -16552,9 +17960,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -16565,12 +17979,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "EmbeddingType"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "EmbeddingType"
+ }
+ }
}
}
}
@@ -16580,16 +18000,23 @@
{
"key": "truncate",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "START"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "START"
+ },
+ {
+ "value": "END"
+ }
+ ],
+ "default": "END"
},
- {
- "value": "END"
- }
- ],
- "default": "END"
+ "default": "END"
+ }
},
"description": "One of `START|END` to specify how the API will handle inputs longer than the maximum token length.\n\nPassing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model.\n"
}
@@ -16619,8 +18046,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -16780,9 +18213,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -16793,9 +18232,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -16806,9 +18251,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -16819,9 +18270,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -16832,9 +18289,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -16845,13 +18308,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17328,9 +18797,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17341,9 +18816,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17354,13 +18835,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17372,13 +18859,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17390,12 +18883,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "DatasetPart"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "DatasetPart"
+ }
+ }
}
}
}
@@ -17407,13 +18906,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17426,8 +18931,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ParseInfo"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ParseInfo"
+ }
+ }
}
}
},
@@ -17436,8 +18947,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Metrics"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Metrics"
+ }
+ }
}
}
}
@@ -17455,9 +18972,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17468,9 +18991,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17507,9 +19036,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17542,9 +19077,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17568,9 +19109,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17581,9 +19128,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17620,13 +19173,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17639,9 +19198,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17652,8 +19217,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ConnectorOAuth"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ConnectorOAuth"
+ }
+ }
}
},
"description": "The OAuth 2.0 configuration for the connector."
@@ -17661,15 +19232,21 @@
{
"key": "auth_status",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "valid"
- },
- {
- "value": "expired"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "valid"
+ },
+ {
+ "value": "expired"
+ }
+ ]
}
- ]
+ }
},
"description": "The OAuth status for the user making the request. One of [\"valid\", \"expired\", \"\"]. Empty string (field is omitted) means the user has not authorized the connector yet."
},
@@ -17678,9 +19255,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -17691,9 +19274,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -17730,9 +19319,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "double"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "double"
+ }
+ }
}
}
},
@@ -17752,9 +19347,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17765,9 +19366,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17778,9 +19385,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17791,9 +19404,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17804,9 +19423,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17890,9 +19515,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -17916,13 +19547,19 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -17935,8 +19572,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "CreateConnectorOAuth"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "CreateConnectorOAuth"
+ }
+ }
}
},
"description": "The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified."
@@ -17946,10 +19589,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean",
- "default": true
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean",
+ "default": true
+ }
+ }
}
}
},
@@ -17960,10 +19609,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean",
- "default": false
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean",
+ "default": false
+ }
+ }
}
}
},
@@ -17974,8 +19629,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "CreateConnectorServiceAuth"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "CreateConnectorServiceAuth"
+ }
+ }
}
},
"description": "The service to service authentication configuration for the connector. Cannot be specified if oauth is specified."
@@ -18287,9 +19948,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -18466,8 +20133,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -18578,9 +20251,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -18591,9 +20270,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -18604,9 +20289,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -18617,9 +20308,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -18630,9 +20327,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -18643,9 +20346,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -18654,34 +20363,46 @@
{
"key": "status",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "unknown"
- },
- {
- "value": "processing"
- },
- {
- "value": "failed"
- },
- {
- "value": "complete"
- },
- {
- "value": "queued"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "unknown"
+ },
+ {
+ "value": "processing"
+ },
+ {
+ "value": "failed"
+ },
+ {
+ "value": "complete"
+ },
+ {
+ "value": "queued"
+ }
+ ]
}
- ]
+ }
}
},
{
"key": "is_final_state",
"valueShape": {
"type": "alias",
- "value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -18692,9 +20413,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -18705,9 +20432,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -18718,12 +20451,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Cluster"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Cluster"
+ }
+ }
}
}
}
@@ -18735,9 +20474,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -18747,8 +20492,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -18783,9 +20534,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
}
@@ -18795,8 +20552,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "ApiMeta"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "ApiMeta"
+ }
+ }
}
}
}
@@ -18826,9 +20589,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -18838,11 +20607,17 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 1,
- "default": 10
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 1,
+ "default": 10
+ }
+ }
}
}
},
@@ -18853,12 +20628,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer",
- "minimum": 2,
- "maximum": 100,
- "default": 15
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer",
+ "minimum": 2,
+ "maximum": 100,
+ "default": 15
+ }
+ }
}
}
},
@@ -18869,10 +20650,16 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean",
- "default": true
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean",
+ "default": true
+ }
+ }
}
}
},
@@ -18883,9 +20670,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
}
@@ -19190,9 +20983,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19256,9 +21055,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19269,9 +21074,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19293,8 +21104,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Strategy"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Strategy"
+ }
+ }
}
},
"description": "Deprecated: The fine-tuning strategy."
@@ -19474,9 +21291,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19521,8 +21344,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Hyperparameters"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Hyperparameters"
+ }
+ }
}
},
"description": "Fine-tuning hyper-parameters."
@@ -19532,9 +21361,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "boolean"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "boolean"
+ }
+ }
}
}
},
@@ -19545,8 +21380,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "WandbConfig"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "WandbConfig"
+ }
+ }
}
},
"description": "The Weights & Biases configuration (Chat fine-tuning only)."
@@ -19603,9 +21444,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19629,9 +21476,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19642,9 +21495,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -19666,8 +21525,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Status"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Status"
+ }
+ }
}
},
"description": "read-only. Current stage in the life-cycle of the fine-tuned model."
@@ -19677,9 +21542,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -19690,9 +21561,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -19703,9 +21580,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -19716,9 +21599,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "datetime"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "datetime"
+ }
+ }
}
}
},
@@ -20069,5 +21958,9 @@
}
},
"subpackages": {},
- "auths": {}
+ "auths": {
+ "bearerAuth": {
+ "type": "bearerAuth"
+ }
+ }
}
\ No newline at end of file
diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json b/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json
index c888063821..491b597dba 100644
--- a/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json
+++ b/packages/parsers/src/__test__/__snapshots__/openapi/deeptune.json
@@ -1,9 +1,12 @@
{
"id": "test-uuid-replacement",
"endpoints": {
- "test-uuid-replacement": {
+ "post-v-1-text-to-speech": {
"description": "API that converts text into lifelike speech with best-in-class latency & uses the most advanced AI audio model ever. Create voiceovers for your videos, audiobooks, or create AI chatbots for free.",
- "id": "/v1/text-to-speech",
+ "namespace": [
+ "text_to_speech"
+ ],
+ "id": "post-v-1-text-to-speech",
"method": "POST",
"path": [
{
@@ -35,9 +38,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-text-to-speech-from-prompt": {
"description": "If you prefer to manage voices on your own, you can use your own audio file as a reference for the voice clone.x",
- "id": "/v1/text-to-speech/from-prompt",
+ "namespace": [
+ "text_to_speech"
+ ],
+ "id": "post-v-1-text-to-speech-from-prompt",
"method": "POST",
"path": [
{
@@ -73,9 +79,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-voices": {
"description": "Retrieve all voices associated with the current workspace.",
- "id": "/v1/voices",
+ "namespace": [
+ "voices"
+ ],
+ "id": "get-v-1-voices",
"method": "GET",
"path": [
{
@@ -108,9 +117,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "post-v-1-voices": {
"description": "Create a new voice with a name, optional description, and audio file.",
- "id": "/v1/voices",
+ "namespace": [
+ "voices"
+ ],
+ "id": "post-v-1-voices",
"method": "POST",
"path": [
{
@@ -153,9 +165,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "get-v-1-voices-voice-id": {
"description": "Retrieve a specific voice by its ID.",
- "id": "/v1/voices/{voice_id}",
+ "namespace": [
+ "voices"
+ ],
+ "id": "get-v-1-voices-voice-id",
"method": "GET",
"path": [
{
@@ -207,9 +222,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "put-v-1-voices-voice-id": {
"description": "Update an existing voice with new name, description, or audio file.",
- "id": "/v1/voices/{voice_id}",
+ "namespace": [
+ "voices"
+ ],
+ "id": "put-v-1-voices-voice-id",
"method": "PUT",
"path": [
{
@@ -271,9 +289,12 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "delete-v-1-voices-voice-id": {
"description": "Delete an existing voice by its ID.",
- "id": "/v1/voices/{voice_id}",
+ "namespace": [
+ "voices"
+ ],
+ "id": "delete-v-1-voices-voice-id",
"method": "DELETE",
"path": [
{
@@ -355,9 +376,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -368,9 +395,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -438,9 +471,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
@@ -451,9 +490,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "integer"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "integer"
+ }
+ }
}
}
},
@@ -608,9 +653,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "string"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "string"
+ }
+ }
}
}
},
diff --git a/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json b/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json
index 1f3dd1af76..765085bf52 100644
--- a/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json
+++ b/packages/parsers/src/__test__/__snapshots__/openapi/petstore.json
@@ -1,9 +1,9 @@
{
"id": "test-uuid-replacement",
"endpoints": {
- "test-uuid-replacement": {
+ "post-pet": {
"description": "Add a new pet to the store",
- "id": "/pet",
+ "id": "post-pet",
"method": "POST",
"path": [
{
@@ -11,6 +11,7 @@
"value": "pet"
}
],
+ "auth": [],
"defaultEnvironment": "x-fern-server-name",
"environments": [
{
@@ -42,9 +43,9 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "put-pet": {
"description": "Update an existing pet by Id",
- "id": "/pet",
+ "id": "put-pet",
"method": "PUT",
"path": [
{
@@ -52,6 +53,7 @@
"value": "pet"
}
],
+ "auth": [],
"defaultEnvironment": "x-fern-server-name",
"environments": [
{
@@ -83,9 +85,9 @@
"errors": [],
"examples": []
},
- "test-uuid-replacement": {
+ "get-pet-pet-id": {
"description": "Returns a pet when 0 < ID <= 10. ID > 10 or nonintegers will simulate API error conditions",
- "id": "/pet/{petId}",
+ "id": "get-pet-pet-id",
"method": "GET",
"path": [
{
@@ -97,6 +99,7 @@
"value": "petId"
}
],
+ "auth": [],
"defaultEnvironment": "x-fern-server-name",
"environments": [
{
@@ -141,7 +144,7 @@
}
},
"description": "Invalid ID supplied",
- "name": "dummy error"
+ "name": "Bad Request"
},
{
"statusCode": 404,
@@ -153,7 +156,7 @@
}
},
"description": "Pet not found",
- "name": "dummy error"
+ "name": "Not Found"
}
],
"examples": []
@@ -538,9 +541,15 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "primitive",
- "value": {
- "type": "long"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "primitive",
+ "value": {
+ "type": "long"
+ }
+ }
}
}
}
@@ -562,8 +571,14 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Category"
+ "type": "optional",
+ "shape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Category"
+ }
+ }
}
}
},
@@ -590,12 +605,18 @@
"valueShape": {
"type": "alias",
"value": {
- "type": "list",
- "itemShape": {
+ "type": "optional",
+ "shape": {
"type": "alias",
"value": {
- "type": "id",
- "id": "Tag"
+ "type": "list",
+ "itemShape": {
+ "type": "alias",
+ "value": {
+ "type": "id",
+ "id": "Tag"
+ }
+ }
}
}
}
@@ -604,18 +625,24 @@
{
"key": "status",
"valueShape": {
- "type": "enum",
- "values": [
- {
- "value": "available"
- },
- {
- "value": "pending"
- },
- {
- "value": "sold"
+ "type": "alias",
+ "value": {
+ "type": "optional",
+ "shape": {
+ "type": "enum",
+ "values": [
+ {
+ "value": "available"
+ },
+ {
+ "value": "pending"
+ },
+ {
+ "value": "sold"
+ }
+ ]
}
- ]
+ }
},
"description": "pet status in the store"
}
diff --git a/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts b/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts
index 968dd194e2..aabaf021ea 100644
--- a/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/OpenApiDocumentConverter.node.ts
@@ -5,11 +5,13 @@ import {
BaseOpenApiV3_1ConverterNode,
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../BaseOpenApiV3_1Converter.node";
-import { basePathExtensionKey } from "../types/extension.types";
import { coalesceServers } from "../utils/3.1/coalesceServers";
+import { SecurityRequirementObjectConverterNode } from "./auth/SecurityRequirementObjectConverter.node";
import { XFernBasePathConverterNode } from "./extensions/XFernBasePathConverter.node";
+import { XFernGroupsConverterNode } from "./extensions/XFernGroupsConverter.node";
import { PathsObjectConverterNode } from "./paths/PathsObjectConverter.node";
import { ServerObjectConverterNode } from "./paths/ServerObjectConverter.node";
+import { WebhooksObjectConverterNode } from "./paths/WebhooksObjectConverter.node";
import { ComponentsConverterNode } from "./schemas/ComponentsConverter.node";
export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
@@ -17,10 +19,12 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
FernRegistry.api.latest.ApiDefinition
> {
paths: PathsObjectConverterNode | undefined;
- // webhooks: WebhooksObjectConverterNode | undefined;
+ webhooks: WebhooksObjectConverterNode | undefined;
components: ComponentsConverterNode | undefined;
servers: ServerObjectConverterNode[] | undefined;
+ auth: SecurityRequirementObjectConverterNode | undefined;
basePath: XFernBasePathConverterNode | undefined;
+ fernGroups: XFernGroupsConverterNode | undefined;
constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
super(args);
@@ -33,15 +37,17 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
input: this.input,
context: this.context,
accessPath: this.accessPath,
- pathId: basePathExtensionKey,
+ pathId: this.pathId,
});
- if (this.input.paths == null) {
+ if (this.input.paths == null && this.input.webhooks == null) {
this.context.errors.warning({
- message: "Expected 'paths' property to be specified",
+ message: "Expected 'paths' or 'webhooks' property to be specified",
path: this.accessPath,
});
- } else {
+ }
+
+ if (this.input.paths != null) {
this.paths = new PathsObjectConverterNode(
{
input: this.input.paths,
@@ -54,7 +60,17 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
);
}
- // TODO: Webhook disambiguation
+ if (this.input.webhooks != null) {
+ this.webhooks = new WebhooksObjectConverterNode(
+ {
+ input: this.input.webhooks,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "webhooks",
+ },
+ this.basePath,
+ );
+ }
if (this.input.components == null) {
this.context.errors.warning({
@@ -69,14 +85,28 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
pathId: "components",
});
}
+
+ if (this.input.security != null) {
+ this.auth = new SecurityRequirementObjectConverterNode({
+ input: this.input.security,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "security",
+ });
+ }
+
+ this.fernGroups = new XFernGroupsConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "x-fern-groups",
+ });
}
convert(): FernRegistry.api.latest.ApiDefinition | undefined {
const apiDefinitionId = v4();
- const endpoints = this.paths?.convert();
- // TODO: Implement webhooks
- // const webhooks = this.webhooks?.convert();
+ const { webhookEndpoints, endpoints } = this.paths?.convert() ?? {};
const types = this.components?.convert();
if (types == null) {
@@ -87,15 +117,12 @@ export class OpenApiDocumentConverterNode extends BaseOpenApiV3_1ConverterNode<
id: FernRegistry.ApiDefinitionId(apiDefinitionId),
endpoints: endpoints ?? {},
// Websockets are not implemented in OAS, but are in AsyncAPI
- websockets: {} as Record,
- // TODO: implement webhooks
- // webhooks,
- webhooks: {} as Record,
+ websockets: {},
+ webhooks: { ...(this.webhooks?.convert() ?? {}), ...(webhookEndpoints ?? {}) },
types,
- // TODO: check if we ever have subpackages
- subpackages: {} as Record,
- // TODO: Implement auths
- auths: {} as Record,
+ // This is not necessary and will be removed
+ subpackages: {},
+ auths: this.auth?.convert() ?? {},
// TODO: Implement globalHeaders
globalHeaders: undefined,
};
diff --git a/packages/parsers/src/openapi/3.1/auth/HeaderSecuritySchemeConverter.node.ts b/packages/parsers/src/openapi/3.1/auth/HeaderSecuritySchemeConverter.node.ts
new file mode 100644
index 0000000000..918de91810
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/HeaderSecuritySchemeConverter.node.ts
@@ -0,0 +1,78 @@
+// This is not a real OAS type, but is used in multiple places, so it is abstracted
+
+import { OpenAPIV3_1 } from "openapi-types";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { XBearerFormatConverterNode } from "../extensions/auth/XBearerFormatConverter.node";
+import { XFernHeaderAuthConverterNode } from "../extensions/auth/XFernHeaderAuthConverter.node";
+import { XFernHeaderVariableNameConverterNode } from "../extensions/auth/XFernHeaderVariableNameConverter.node";
+import { isApiKeySecurityScheme } from "../guards/isApiKeySecurityScheme";
+
+export declare namespace HeaderSecuritySchemeConverterNode {
+ export interface Input extends OpenAPIV3_1.ApiKeySecurityScheme {
+ in: "header";
+ }
+}
+
+export class HeaderSecuritySchemeConverterNode extends BaseOpenApiV3_1ConverterNode<
+ HeaderSecuritySchemeConverterNode.Input | OpenAPIV3_1.OAuth2SecurityScheme,
+ FernRegistry.api.v1.read.ApiAuth.Header
+> {
+ headerName: string | undefined;
+ // x-bearer-format
+ headerBearerFormatNode: XBearerFormatConverterNode | undefined;
+ // x-fern-header
+ headerAuthNode: XFernHeaderAuthConverterNode | undefined;
+ // x-fern-header-variable-name
+ headerVariableNameNode: XFernHeaderVariableNameConverterNode | undefined;
+
+ constructor(
+ args: BaseOpenApiV3_1ConverterNodeConstructorArgs<
+ HeaderSecuritySchemeConverterNode.Input | OpenAPIV3_1.OAuth2SecurityScheme
+ >,
+ ) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ if (isApiKeySecurityScheme(this.input)) {
+ this.headerName = this.input.name;
+ }
+ this.headerAuthNode = new XFernHeaderAuthConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.headerVariableNameNode = new XFernHeaderVariableNameConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.headerBearerFormatNode = new XBearerFormatConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ }
+
+ convert(): FernRegistry.api.v1.read.ApiAuth.Header | undefined {
+ const headerAuth = this.headerAuthNode?.convert();
+ if (headerAuth == null) {
+ return undefined;
+ }
+
+ return {
+ type: "header",
+ nameOverride: headerAuth?.name,
+ headerWireValue: this.headerName ?? "Authorization",
+ prefix: headerAuth?.prefix ?? this.headerBearerFormatNode?.convert(),
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/auth/OAuth2SecuritySchemeConverter.node.ts b/packages/parsers/src/openapi/3.1/auth/OAuth2SecuritySchemeConverter.node.ts
new file mode 100644
index 0000000000..b422152599
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/OAuth2SecuritySchemeConverter.node.ts
@@ -0,0 +1,87 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { getEndpointId } from "../../utils/getEndpointId";
+import { XFernAccessTokenLocatorConverterNode } from "../extensions/auth/XFernAccessTokenLocatorConverter.node";
+import { HeaderSecuritySchemeConverterNode } from "./HeaderSecuritySchemeConverter.node";
+
+export class OAuth2SecuritySchemeConverterNode extends BaseOpenApiV3_1ConverterNode<
+ OpenAPIV3_1.OAuth2SecurityScheme,
+ FernRegistry.api.latest.AuthScheme
+> {
+ authorizationUrl: string | undefined;
+
+ headerAuthNode: HeaderSecuritySchemeConverterNode | undefined;
+
+ accessTokenLocatorNode: XFernAccessTokenLocatorConverterNode | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ if (this.input.flows.clientCredentials != null) {
+ const clientCredentialsFlow = this.input.flows.clientCredentials;
+ this.authorizationUrl = clientCredentialsFlow.tokenUrl;
+
+ if (this.authorizationUrl == null) {
+ this.context.errors.error({
+ message: "Expected 'tokenUrl' property to be specified",
+ path: this.accessPath,
+ });
+ }
+
+ this.headerAuthNode = new HeaderSecuritySchemeConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.accessTokenLocatorNode = new XFernAccessTokenLocatorConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+
+ if (this.authorizationUrl == null) {
+ this.context.errors.error({
+ message: "Expected 'tokenUrl' property to be specified",
+ path: this.accessPath,
+ });
+ }
+
+ if (this.accessTokenLocatorNode?.accessTokenLocator == null) {
+ this.context.errors.error({
+ message: "Expected 'x-fern-access-token-locator' property to be specified",
+ path: this.accessPath,
+ });
+ }
+ }
+ }
+
+ convert(): FernRegistry.api.latest.AuthScheme | undefined {
+ const accessTokenLocator = this.accessTokenLocatorNode?.convert();
+ if (accessTokenLocator == null || this.authorizationUrl == null) {
+ return undefined;
+ }
+
+ return {
+ type: "oAuth",
+ value: {
+ type: "clientCredentials",
+ value: {
+ type: "referencedEndpoint",
+ endpointId: FernRegistry.EndpointId(getEndpointId("post", this.authorizationUrl)),
+ accessTokenLocator: FernRegistry.JqString(accessTokenLocator),
+ headerName: this.headerAuthNode?.convert()?.headerWireValue,
+ tokenPrefix: this.headerAuthNode?.convert()?.prefix,
+ },
+ },
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/auth/SecurityRequirementObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/auth/SecurityRequirementObjectConverter.node.ts
new file mode 100644
index 0000000000..5212d47a96
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/SecurityRequirementObjectConverter.node.ts
@@ -0,0 +1,67 @@
+import { isNonNullish } from "@fern-api/ui-core-utils";
+import { OpenAPIV3_1 } from "openapi-types";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { resolveSecurityScheme } from "../../utils/3.1/resolveSecurityScheme";
+import { SecuritySchemeConverterNode } from "./SecuritySchemeConverter.node";
+
+export class SecurityRequirementObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
+ OpenAPIV3_1.SecurityRequirementObject[],
+ FernRegistry.api.latest.ApiDefinition["auths"]
+> {
+ authNodesMap: Record | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.input.map((securityScheme, index) =>
+ Object.keys(securityScheme).map((key) => {
+ const resolvedSecurityScheme = resolveSecurityScheme(key, this.context.document);
+ if (resolvedSecurityScheme == null) {
+ this.context.errors.warning({
+ message: `No auth scheme found for ${key}`,
+ path: this.accessPath,
+ });
+ return;
+ }
+
+ const resolvedAuthScheme = new SecuritySchemeConverterNode({
+ input: resolvedSecurityScheme,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: `security[${index}]`,
+ });
+
+ if (resolvedAuthScheme.convert() != null) {
+ this.authNodesMap ??= {};
+ this.authNodesMap[key] = resolvedAuthScheme;
+ } else {
+ this.context.errors.warning({
+ message: `No auth scheme found for ${key}`,
+ path: this.accessPath,
+ });
+ }
+ }),
+ );
+ }
+
+ convert(): FernRegistry.api.latest.ApiDefinition["auths"] | undefined {
+ return Object.fromEntries(
+ Object.entries(this.authNodesMap ?? {})
+ .map(([key, value]) => {
+ const convertedValue = value.convert();
+ if (convertedValue == null) {
+ return undefined;
+ }
+ return [key, convertedValue];
+ })
+ .filter(isNonNullish),
+ );
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts b/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts
new file mode 100644
index 0000000000..b81e1c0db4
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/SecuritySchemeConverter.node.ts
@@ -0,0 +1,176 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { UnreachableCaseError } from "ts-essentials";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { XFernBasicAuthNode } from "../extensions/auth/XFernBasicAuth.node";
+import { XFernBasicPasswordVariableNameConverterNode } from "../extensions/auth/XFernBasicPasswordVariableNameConverter.node";
+import { XFernBasicUsernameVariableNameConverterNode } from "../extensions/auth/XFernBasicUsernameVariableNameConverter.node";
+import { XFernBearerTokenConverterNode } from "../extensions/auth/XFernBearerTokenConverter.node";
+import { XFernBearerTokenVariableNameConverterNode } from "../extensions/auth/XFernBearerTokenVariableNameConverter.node";
+import { isInHeader } from "../guards/isInHeader";
+import { HeaderSecuritySchemeConverterNode } from "./HeaderSecuritySchemeConverter.node";
+import { OAuth2SecuritySchemeConverterNode } from "./OAuth2SecuritySchemeConverter.node";
+
+export class SecuritySchemeConverterNode extends BaseOpenApiV3_1ConverterNode<
+ OpenAPIV3_1.SecuritySchemeObject,
+ FernRegistry.api.latest.AuthScheme
+> {
+ authScheme: "basic" | "bearer" | "oauth" | "header" | undefined;
+
+ // Header auth
+ headerAuthNode: HeaderSecuritySchemeConverterNode | undefined;
+
+ // Bearer auth
+ // x-fern-bearer
+ bearerTokenNode: XFernBearerTokenConverterNode | undefined;
+ // x-fern-token-variable-name
+ bearerTokenVariableNameNode: XFernBearerTokenVariableNameConverterNode | undefined;
+
+ // Basic auth
+ // x-fern-basic
+ basicAuthNode: XFernBasicAuthNode | undefined;
+ // x-fern-username-variable-name
+ basicUsernameVariableNameNode: XFernBasicUsernameVariableNameConverterNode | undefined;
+ // x-fern-password-variable-name
+ basicPasswordVariableNameNode: XFernBasicPasswordVariableNameConverterNode | undefined;
+
+ // OAuth2
+ oauth2Node: OAuth2SecuritySchemeConverterNode | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ switch (this.input.type) {
+ case "http":
+ switch (this.input.scheme) {
+ case "basic": {
+ this.authScheme = "basic";
+ this.basicAuthNode = new XFernBasicAuthNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.basicUsernameVariableNameNode = new XFernBasicUsernameVariableNameConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.basicPasswordVariableNameNode = new XFernBasicPasswordVariableNameConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+
+ if (
+ this.basicAuthNode == null ||
+ (this.basicAuthNode.username == null &&
+ this.basicUsernameVariableNameNode?.usernameVariableName == null) ||
+ (this.basicAuthNode.password == null &&
+ this.basicPasswordVariableNameNode?.passwordVariableName == null)
+ ) {
+ this.context.errors.warning({
+ message: "Basic auth should specify either a username or a username variable name",
+ path: this.accessPath,
+ });
+ }
+ break;
+ }
+ case "bearer": {
+ this.authScheme = "bearer";
+ this.bearerTokenNode = new XFernBearerTokenConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ this.bearerTokenVariableNameNode = new XFernBearerTokenVariableNameConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ break;
+ }
+ default: {
+ this.context.errors.warning({
+ message: `Unsupported HTTP auth scheme: ${this.input.scheme}`,
+ path: this.accessPath,
+ });
+ break;
+ }
+ }
+ break;
+ case "apiKey": {
+ if (!isInHeader(this.input)) {
+ this.context.errors.error({
+ message: `Unsupported API key location: ${this.input.in}`,
+ path: this.accessPath,
+ });
+ } else {
+ this.authScheme = "header";
+ this.headerAuthNode = new HeaderSecuritySchemeConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ }
+ break;
+ }
+ case "oauth2": {
+ this.authScheme = "oauth";
+ this.oauth2Node = new OAuth2SecuritySchemeConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ break;
+ }
+ case "openIdConnect": {
+ this.authScheme = "bearer";
+ break;
+ }
+ }
+ }
+
+ convert(): FernRegistry.api.latest.AuthScheme | undefined {
+ switch (this.authScheme) {
+ case "basic": {
+ const basicAuth = this.basicAuthNode?.convert();
+ return {
+ type: "basicAuth",
+ usernameName: basicAuth?.username?.name ?? this.basicUsernameVariableNameNode?.convert(),
+ passwordName: basicAuth?.password?.name ?? this.basicPasswordVariableNameNode?.convert(),
+ };
+ }
+ case "bearer": {
+ const bearerAuth = this.bearerTokenNode?.convert();
+ return {
+ type: "bearerAuth",
+ tokenName: bearerAuth?.tokenVariableName ?? this.bearerTokenVariableNameNode?.convert(),
+ };
+ }
+ case "header": {
+ return this.headerAuthNode?.convert();
+ }
+ case "oauth": {
+ return this.oauth2Node?.convert();
+ }
+ case undefined:
+ return undefined;
+ default:
+ new UnreachableCaseError(this.authScheme);
+ return undefined;
+ }
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/auth/__test__/HeaderSecuritySchemeConverter.node.test.ts b/packages/parsers/src/openapi/3.1/auth/__test__/HeaderSecuritySchemeConverter.node.test.ts
new file mode 100644
index 0000000000..d09d7b88cf
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/__test__/HeaderSecuritySchemeConverter.node.test.ts
@@ -0,0 +1,91 @@
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { HeaderSecuritySchemeConverterNode } from "../HeaderSecuritySchemeConverter.node";
+
+describe("HeaderSecuritySchemeConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse header auth with all fields", () => {
+ const input = {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization",
+ "x-fern-header-variable-name": "myHeader",
+ "x-fern-header": {
+ name: "customHeader",
+ prefix: "Bearer",
+ env: "MY_HEADER_ENV",
+ },
+ "x-bearer-format": "JWT",
+ } as HeaderSecuritySchemeConverterNode.Input;
+
+ const node = new HeaderSecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "header",
+ nameOverride: "customHeader",
+ headerWireValue: "Authorization",
+ prefix: "Bearer",
+ });
+ });
+
+ it("should use bearer format when prefix not provided", () => {
+ const input = {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization",
+ "x-fern-header": {
+ name: "customHeader",
+ env: "MY_HEADER_ENV",
+ },
+ "x-bearer-format": "JWT",
+ } as HeaderSecuritySchemeConverterNode.Input;
+
+ const node = new HeaderSecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "header",
+ nameOverride: "customHeader",
+ headerWireValue: "Authorization",
+ prefix: "JWT",
+ });
+ });
+
+ it("should use default Authorization header when variable name not provided", () => {
+ const input = {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization",
+ "x-fern-header": {
+ name: "customHeader",
+ prefix: "Bearer",
+ },
+ } as HeaderSecuritySchemeConverterNode.Input;
+
+ const node = new HeaderSecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "header",
+ nameOverride: "customHeader",
+ headerWireValue: "Authorization",
+ prefix: "Bearer",
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/auth/__test__/OAuth2SecuritySchemeConverter.node.test.ts b/packages/parsers/src/openapi/3.1/auth/__test__/OAuth2SecuritySchemeConverter.node.test.ts
new file mode 100644
index 0000000000..26b8f42368
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/__test__/OAuth2SecuritySchemeConverter.node.test.ts
@@ -0,0 +1,107 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { OAuth2SecuritySchemeConverterNode } from "../OAuth2SecuritySchemeConverter.node";
+
+describe("OAuth2SecuritySchemeConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse OAuth2 client credentials flow", () => {
+ const input = {
+ type: "oauth2",
+ flows: {
+ clientCredentials: {
+ tokenUrl: "https://api.example.com/oauth/token",
+ scopes: {},
+ },
+ },
+ "x-fern-access-token-locator": "$.access_token",
+ "x-fern-header": {
+ name: "Authorization",
+ prefix: "Bearer",
+ },
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new OAuth2SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "oAuth",
+ value: {
+ type: "clientCredentials",
+ value: {
+ type: "referencedEndpoint",
+ endpointId: "post-https-api-example-com-oauth-token",
+ accessTokenLocator: "$.access_token",
+ headerName: "Authorization",
+ tokenPrefix: "Bearer",
+ },
+ },
+ });
+ });
+
+ it("should handle missing token URL", () => {
+ const input = {
+ type: "oauth2",
+ flows: {
+ clientCredentials: {
+ scopes: {},
+ },
+ },
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new OAuth2SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toBeUndefined();
+ expect(mockContext.errors.error).toHaveBeenCalledWith({
+ message: "Expected 'tokenUrl' property to be specified",
+ path: ["test"],
+ });
+ });
+
+ it("should handle missing access token locator", () => {
+ const input = {
+ type: "oauth2",
+ flows: {
+ clientCredentials: {
+ tokenUrl: "https://api.example.com/oauth/token",
+ scopes: {},
+ },
+ },
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new OAuth2SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toBeUndefined();
+ });
+
+ it("should handle missing client credentials flow", () => {
+ const input = {
+ type: "oauth2",
+ flows: {},
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new OAuth2SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/auth/__test__/SecurityRequirementObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/auth/__test__/SecurityRequirementObjectConverter.node.test.ts
new file mode 100644
index 0000000000..ce7bd2ffa5
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/__test__/SecurityRequirementObjectConverter.node.test.ts
@@ -0,0 +1,186 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { SecurityRequirementObjectConverterNode } from "../SecurityRequirementObjectConverter.node";
+
+describe("SecurityRequirementObjectConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse security requirements with header auth", () => {
+ const input = [
+ {
+ apiKey: [],
+ },
+ ];
+
+ const mockDocument = {
+ components: {
+ securitySchemes: {
+ apiKey: {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization",
+ "x-fern-header": {
+ name: "customHeader",
+ prefix: "Bearer",
+ },
+ },
+ },
+ },
+ } as unknown as OpenAPIV3_1.Document;
+
+ const node = new SecurityRequirementObjectConverterNode({
+ input,
+ context: {
+ ...mockContext,
+ document: mockDocument,
+ },
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ apiKey: {
+ headerWireValue: "Authorization",
+ type: "header",
+ nameOverride: "customHeader",
+ prefix: "Bearer",
+ },
+ });
+ });
+
+ it("should handle missing security scheme", () => {
+ const input = [
+ {
+ missingScheme: [],
+ },
+ ];
+
+ const mockDocument = {
+ components: {
+ securitySchemes: {},
+ },
+ } as unknown as OpenAPIV3_1.Document;
+
+ const node = new SecurityRequirementObjectConverterNode({
+ input,
+ context: {
+ ...mockContext,
+ document: mockDocument,
+ },
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({});
+ });
+
+ it("should handle multiple security schemes", () => {
+ const input = [
+ {
+ apiKey1: [],
+ apiKey2: [],
+ },
+ ];
+
+ const mockDocument = {
+ components: {
+ securitySchemes: {
+ apiKey1: {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization1",
+ "x-fern-header": {
+ name: "customHeader1",
+ prefix: "Bearer",
+ },
+ },
+ apiKey2: {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization2",
+ "x-fern-header": {
+ name: "customHeader2",
+ prefix: "Basic",
+ },
+ },
+ },
+ },
+ } as unknown as OpenAPIV3_1.Document;
+
+ const node = new SecurityRequirementObjectConverterNode({
+ input,
+ context: {
+ ...mockContext,
+ document: mockDocument,
+ },
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ apiKey1: {
+ headerWireValue: "Authorization1",
+ type: "header",
+ nameOverride: "customHeader1",
+ prefix: "Bearer",
+ },
+ apiKey2: {
+ headerWireValue: "Authorization2",
+ type: "header",
+ nameOverride: "customHeader2",
+ prefix: "Basic",
+ },
+ });
+ });
+
+ it("should filter out null converted values", () => {
+ const input = [
+ {
+ validKey: [],
+ invalidKey: [],
+ },
+ ];
+
+ const mockDocument = {
+ components: {
+ securitySchemes: {
+ validKey: {
+ type: "apiKey",
+ in: "header",
+ name: "Authorization",
+ "x-fern-header": {
+ name: "customHeader",
+ prefix: "Bearer",
+ },
+ },
+ invalidKey: {
+ type: "invalid",
+ },
+ },
+ },
+ } as unknown as OpenAPIV3_1.Document;
+
+ const node = new SecurityRequirementObjectConverterNode({
+ input,
+ context: {
+ ...mockContext,
+ document: mockDocument,
+ },
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ validKey: {
+ headerWireValue: "Authorization",
+ type: "header",
+ nameOverride: "customHeader",
+ prefix: "Bearer",
+ },
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/auth/__test__/SecuritySchemeConverter.node.test.ts b/packages/parsers/src/openapi/3.1/auth/__test__/SecuritySchemeConverter.node.test.ts
new file mode 100644
index 0000000000..4bc12cfe3d
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/auth/__test__/SecuritySchemeConverter.node.test.ts
@@ -0,0 +1,282 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { SecuritySchemeConverterNode } from "../SecuritySchemeConverter.node";
+
+describe("SecuritySchemeConverterNode", () => {
+ const mockContext = createMockContext();
+
+ describe("basic auth", () => {
+ it("should parse basic auth with username and password", () => {
+ const input = {
+ type: "http",
+ scheme: "basic",
+ "x-fern-basic": {
+ username: {
+ name: "myUsername",
+ },
+ password: {
+ name: "myPassword",
+ },
+ },
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "basicAuth",
+ usernameName: "myUsername",
+ passwordName: "myPassword",
+ });
+ });
+
+ it("should parse basic auth with variable names", () => {
+ const input = {
+ type: "http",
+ scheme: "basic",
+ "x-fern-username-variable-name": "USERNAME_VAR",
+ "x-fern-password-variable-name": "PASSWORD_VAR",
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "basicAuth",
+ usernameName: "USERNAME_VAR",
+ passwordName: "PASSWORD_VAR",
+ });
+ });
+
+ it("should warn if username/password not provided", () => {
+ const input = {
+ type: "http",
+ scheme: "basic",
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ node.convert();
+
+ expect(mockContext.errors.warning).toHaveBeenCalledWith({
+ message: "Basic auth should specify either a username or a username variable name",
+ path: ["test"],
+ });
+ });
+ });
+
+ describe("bearer auth", () => {
+ it("should parse bearer auth with token", () => {
+ const input = {
+ type: "http",
+ scheme: "bearer",
+ "x-fern-bearer": {
+ name: "myToken",
+ },
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "bearerAuth",
+ tokenName: "myToken",
+ });
+ });
+
+ it("should parse bearer auth with variable name", () => {
+ const input = {
+ type: "http",
+ scheme: "bearer",
+ "x-fern-token-variable-name": "TOKEN_VAR",
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "bearerAuth",
+ tokenName: "TOKEN_VAR",
+ });
+ });
+ });
+
+ describe("header auth", () => {
+ it("should parse header auth", () => {
+ const input = {
+ type: "apiKey",
+ in: "header",
+ name: "X-API-Key",
+ "x-fern-header": {
+ name: "customHeader",
+ },
+ } as OpenAPIV3_1.ApiKeySecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ headerWireValue: "X-API-Key",
+ type: "header",
+ nameOverride: "customHeader",
+ });
+ });
+
+ it("should error on non-header API key", () => {
+ const input = {
+ type: "apiKey",
+ in: "query",
+ name: "api_key",
+ } as OpenAPIV3_1.ApiKeySecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ node.convert();
+
+ expect(mockContext.errors.error).toHaveBeenCalledWith({
+ message: "Unsupported API key location: query",
+ path: ["test"],
+ });
+ });
+ });
+
+ describe("oauth2", () => {
+ it("should parse OAuth2 auth", () => {
+ const input = {
+ type: "oauth2",
+ flows: {
+ clientCredentials: {
+ tokenUrl: "https://api.example.com/oauth/token",
+ scopes: {},
+ },
+ },
+ "x-fern-access-token-locator": "$.body.access_token",
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "oAuth",
+ value: {
+ type: "clientCredentials",
+ value: {
+ type: "referencedEndpoint",
+ endpointId: "post-https-api-example-com-oauth-token",
+ accessTokenLocator: "$.body.access_token",
+ headerName: "Authorization",
+ },
+ },
+ });
+ });
+
+ it("should fail OAuth2 auth without access token locator", () => {
+ const input = {
+ type: "oauth2",
+ flows: {
+ clientCredentials: {
+ tokenUrl: "https://api.example.com/oauth/token",
+ scopes: {},
+ },
+ },
+ } as OpenAPIV3_1.OAuth2SecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ node.convert();
+
+ expect(mockContext.errors.error).toHaveBeenCalledWith({
+ message: "Expected 'x-fern-access-token-locator' property to be specified",
+ path: ["test"],
+ });
+ });
+ });
+
+ describe("openIdConnect", () => {
+ it("should parse OpenID Connect as bearer auth", () => {
+ const input = {
+ type: "openIdConnect",
+ openIdConnectUrl: "https://example.com/.well-known/openid-configuration",
+ } as OpenAPIV3_1.OpenIdSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ type: "bearerAuth",
+ tokenName: undefined,
+ });
+ });
+ });
+
+ it("should handle unsupported HTTP schemes", () => {
+ const input = {
+ type: "http",
+ scheme: "digest",
+ } as OpenAPIV3_1.HttpSecurityScheme;
+
+ const node = new SecuritySchemeConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ node.convert();
+
+ expect(mockContext.errors.warning).toHaveBeenCalledWith({
+ message: "Unsupported HTTP auth scheme: digest",
+ path: ["test"],
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/AvailabilityConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/AvailabilityConverter.node.ts
index 04a819986f..08fa0a3f7c 100644
--- a/packages/parsers/src/openapi/3.1/extensions/AvailabilityConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/extensions/AvailabilityConverter.node.ts
@@ -8,9 +8,16 @@ import {
import { ConstArrayToType, SUPPORTED_X_FERN_AVAILABILITY_VALUES } from "../../types/format.types";
import { resolveSchemaReference } from "../../utils/3.1/resolveSchemaReference";
import { extendType } from "../../utils/extendType";
+import { xFernAvailabilityKey } from "./fernExtension.consts";
export type Availability = ConstArrayToType;
+export declare namespace AvailabilityConverterNode {
+ export interface Input {
+ [xFernAvailabilityKey]?: Availability;
+ }
+}
+
export class AvailabilityConverterNode extends BaseOpenApiV3_1ConverterNode<
{ deprecated?: boolean } | OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject,
FernRegistry.Availability | undefined
@@ -30,9 +37,7 @@ export class AvailabilityConverterNode extends BaseOpenApiV3_1ConverterNode<
if (input?.deprecated) {
this.availability = "deprecated";
} else {
- const maybeAvailability = extendType<{
- "x-fern-availability"?: Availability;
- }>(this.input)["x-fern-availability"];
+ const maybeAvailability = extendType(this.input)[xFernAvailabilityKey];
if (maybeAvailability != null) {
if (SUPPORTED_X_FERN_AVAILABILITY_VALUES.includes(maybeAvailability)) {
this.availability = maybeAvailability;
diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernBasePathConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernBasePathConverter.node.ts
index 5fa69eff55..dd52e5b218 100644
--- a/packages/parsers/src/openapi/3.1/extensions/XFernBasePathConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/extensions/XFernBasePathConverter.node.ts
@@ -3,8 +3,13 @@ import {
BaseOpenApiV3_1ConverterNode,
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../../BaseOpenApiV3_1Converter.node";
-import { basePathExtensionKey } from "../../types/extension.types";
import { extendType } from "../../utils/extendType";
+import { xFernBasePathKey } from "./fernExtension.consts";
+export declare namespace XFernBasePathConverterNode {
+ export interface Input {
+ [xFernBasePathKey]?: string;
+ }
+}
export class XFernBasePathConverterNode extends BaseOpenApiV3_1ConverterNode {
basePath?: string;
@@ -15,7 +20,7 @@ export class XFernBasePathConverterNode extends BaseOpenApiV3_1ConverterNode(this.input)[basePathExtensionKey];
+ this.basePath = extendType(this.input)[xFernBasePathKey];
if (this.basePath != null) {
if (this.basePath.startsWith("/")) {
diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts
index 8c16e740f1..55e1d7d96c 100644
--- a/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/extensions/XFernGroupNameConverter.node.ts
@@ -1,17 +1,22 @@
+import { FernRegistry } from "../../../client/generated";
import {
BaseOpenApiV3_1ConverterNode,
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../../BaseOpenApiV3_1Converter.node";
import { extendType } from "../../utils/extendType";
+import { xFernGroupNameKey } from "./fernExtension.consts";
export declare namespace XFernGroupNameConverterNode {
export interface Input {
- "x-fern-group-name"?: string;
+ [xFernGroupNameKey]?: string | string[];
}
}
-export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode {
- groupName?: string;
+export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode<
+ unknown,
+ FernRegistry.api.latest.SubpackageId[]
+> {
+ groupName?: string | string[];
constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
super(args);
@@ -20,10 +25,21 @@ export class XFernGroupNameConverterNode extends BaseOpenApiV3_1ConverterNode(this.input)["x-fern-group-name"];
+ this.groupName = extendType(this.input)[xFernGroupNameKey];
}
- convert(): string | undefined {
- return this.groupName;
+ convert(): FernRegistry.api.latest.SubpackageId[] | undefined {
+ if (this.groupName == null) {
+ return undefined;
+ }
+
+ let subpackagePath: string[];
+ if (Array.isArray(this.groupName)) {
+ subpackagePath = this.groupName;
+ } else {
+ subpackagePath = [this.groupName];
+ }
+
+ return subpackagePath.map((path) => FernRegistry.api.v1.SubpackageId(path));
}
}
diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts
new file mode 100644
index 0000000000..87cf2930f2
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/XFernGroupsConverter.node.ts
@@ -0,0 +1,35 @@
+import { noop } from "ts-essentials";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../utils/extendType";
+import { xFernGroupsKey } from "./fernExtension.consts";
+
+export declare namespace XFernGroupsConverterNode {
+ export interface Group {
+ description?: string;
+ summary?: string;
+ }
+
+ export interface Input {
+ [xFernGroupsKey]?: Record[];
+ }
+}
+
+export class XFernGroupsConverterNode extends BaseOpenApiV3_1ConverterNode {
+ groups?: Record[];
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.groups = extendType(this.input)[xFernGroupsKey];
+ }
+
+ convert(): void | undefined {
+ noop();
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts
new file mode 100644
index 0000000000..9c1c6675fe
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/XFernWebhookConverter.node.ts
@@ -0,0 +1,20 @@
+import { BaseOpenApiV3_1ConverterNode } from "../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../utils/extendType";
+import { xFernWebhookKey } from "./fernExtension.consts";
+
+export declare namespace XFernWebhookConverterNode {
+ export interface Input {
+ [xFernWebhookKey]?: boolean;
+ }
+}
+
+export class XFernWebhookConverterNode extends BaseOpenApiV3_1ConverterNode {
+ isWebhook?: boolean;
+
+ parse(): void {
+ this.isWebhook = extendType(this.input)[xFernWebhookKey];
+ }
+ convert(): boolean | undefined {
+ return this.isWebhook ? undefined : undefined;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernBasePathConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernBasePathConverter.node.test.ts
index 9a4c7fe131..8fdcf37280 100644
--- a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernBasePathConverter.node.test.ts
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernBasePathConverter.node.test.ts
@@ -1,15 +1,15 @@
import { OpenAPIV3_1 } from "openapi-types";
import { createMockContext } from "../../../../__test__/createMockContext.util";
-import { basePathExtensionKey } from "../../../types/extension.types";
import { XFernBasePathConverterNode } from "../XFernBasePathConverter.node";
+import { xFernBasePathKey } from "../fernExtension.consts";
describe("XFernGroupNameConverterNode", () => {
const mockContext = createMockContext();
describe("parse", () => {
- it(`sets basePath from ${basePathExtensionKey} when present`, () => {
+ it(`sets basePath from ${xFernBasePathKey} when present`, () => {
const converter = new XFernBasePathConverterNode({
- input: { [basePathExtensionKey]: "/v1" } as unknown as OpenAPIV3_1.Document,
+ input: { [xFernBasePathKey]: "/v1" } as unknown as OpenAPIV3_1.Document,
context: mockContext,
accessPath: [],
pathId: "",
@@ -17,9 +17,9 @@ describe("XFernGroupNameConverterNode", () => {
expect(converter.basePath).toBe("v1");
});
- it(`properly formats ${basePathExtensionKey} with slashes`, () => {
+ it(`properly formats ${xFernBasePathKey} with slashes`, () => {
const converter = new XFernBasePathConverterNode({
- input: { [basePathExtensionKey]: "/v1/" } as unknown as OpenAPIV3_1.Document,
+ input: { [xFernBasePathKey]: "/v1/" } as unknown as OpenAPIV3_1.Document,
context: mockContext,
accessPath: [],
pathId: "",
@@ -27,7 +27,7 @@ describe("XFernGroupNameConverterNode", () => {
expect(converter.basePath).toBe("v1");
});
- it(`sets basePath to undefined when ${basePathExtensionKey} is not present`, () => {
+ it(`sets basePath to undefined when ${xFernBasePathKey} is not present`, () => {
const converter = new XFernBasePathConverterNode({
input: {} as unknown as OpenAPIV3_1.Document,
context: mockContext,
@@ -37,9 +37,9 @@ describe("XFernGroupNameConverterNode", () => {
expect(converter.basePath).toBeUndefined();
});
- it(`sets basePath to undefined when ${basePathExtensionKey} is explicitly null`, () => {
+ it(`sets basePath to undefined when ${xFernBasePathKey} is explicitly null`, () => {
const converter = new XFernBasePathConverterNode({
- input: { [basePathExtensionKey]: null } as unknown as OpenAPIV3_1.Document,
+ input: { [xFernBasePathKey]: null } as unknown as OpenAPIV3_1.Document,
context: mockContext,
accessPath: [],
pathId: "",
@@ -51,7 +51,7 @@ describe("XFernGroupNameConverterNode", () => {
describe("convert", () => {
it("returns the basePath value", () => {
const converter = new XFernBasePathConverterNode({
- input: { [basePathExtensionKey]: "/v1" } as unknown as OpenAPIV3_1.Document,
+ input: { [xFernBasePathKey]: "/v1" } as unknown as OpenAPIV3_1.Document,
context: mockContext,
accessPath: [],
pathId: "",
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts
index 1da668305a..c6b9cd26eb 100644
--- a/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/XFernGroupNameConverter.node.test.ts
@@ -7,12 +7,12 @@ describe("XFernGroupNameConverterNode", () => {
describe("parse", () => {
it("sets groupName from x-fern-group-name when present", () => {
const converter = new XFernGroupNameConverterNode({
- input: { "x-fern-group-name": "test-group" },
+ input: { "x-fern-sdk-group-name": "test-group" },
context: mockContext,
accessPath: [],
pathId: "",
});
- expect(converter.groupName).toBe("test-group");
+ expect(converter.groupName).toEqual("test-group");
});
it("sets groupName to undefined when x-fern-group-name is not present", () => {
@@ -29,12 +29,12 @@ describe("XFernGroupNameConverterNode", () => {
describe("convert", () => {
it("returns the groupName value", () => {
const converter = new XFernGroupNameConverterNode({
- input: { "x-fern-group-name": "test-group" },
+ input: { "x-fern-sdk-group-name": "test-group" },
context: mockContext,
accessPath: [],
pathId: "",
});
- expect(converter.convert()).toBe("test-group");
+ expect(converter.convert()).toEqual(["test-group"]);
});
it("returns undefined when groupName is not set", () => {
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernAccessTokenLocatorConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernAccessTokenLocatorConverter.node.test.ts
new file mode 100644
index 0000000000..695df58bd0
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernAccessTokenLocatorConverter.node.test.ts
@@ -0,0 +1,56 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernAccessTokenLocatorConverterNode } from "../../auth/XFernAccessTokenLocatorConverter.node";
+
+describe("XFernAccessTokenLocatorConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse valid JSON access token locator", () => {
+ const input = {
+ "x-fern-access-token-locator": "$.token.access",
+ };
+
+ const node = new XFernAccessTokenLocatorConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.accessTokenLocator).toBe("$.token.access");
+ expect(node.convert()).toBe("$.token.access");
+ });
+
+ it("should handle missing access token locator", () => {
+ const input = {};
+
+ const node = new XFernAccessTokenLocatorConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.accessTokenLocator).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+
+ it("should handle invalid JSON access token locator", () => {
+ const input = {
+ "x-fern-access-token-locator": "invalid json",
+ };
+
+ const node = new XFernAccessTokenLocatorConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(mockContext.errors.error).toHaveBeenCalledWith({
+ message: "Invalid access token locator, must be a valid jq path",
+ path: ["test"],
+ });
+ expect(node.convert()).toBeUndefined();
+ });
+});
+export { XFernAccessTokenLocatorConverterNode };
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicAuth.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicAuth.node.test.ts
new file mode 100644
index 0000000000..753339cfd1
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicAuth.node.test.ts
@@ -0,0 +1,103 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernBasicAuthNode } from "../../auth/XFernBasicAuth.node";
+import { TokenSecurityScheme } from "../../auth/types/TokenSecurityScheme";
+
+describe("XFernBasicAuthNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse basic auth with username and password", () => {
+ const input = {
+ "x-fern-basic": {
+ username: {
+ type: "basic",
+ value: "testuser",
+ } as TokenSecurityScheme,
+ password: {
+ type: "basic",
+ value: "testpass",
+ } as TokenSecurityScheme,
+ },
+ };
+
+ const node = new XFernBasicAuthNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.username).toEqual({
+ type: "basic",
+ value: "testuser",
+ });
+ expect(node.password).toEqual({
+ type: "basic",
+ value: "testpass",
+ });
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ username: {
+ type: "basic",
+ value: "testuser",
+ },
+ password: {
+ type: "basic",
+ value: "testpass",
+ },
+ });
+ });
+
+ it("should handle missing auth scheme", () => {
+ const input = {};
+
+ const node = new XFernBasicAuthNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.username).toBeUndefined();
+ expect(node.password).toBeUndefined();
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ username: undefined,
+ password: undefined,
+ });
+ });
+
+ it("should handle partial auth scheme", () => {
+ const input = {
+ "x-fern-basic": {
+ username: {
+ type: "basic",
+ value: "testuser",
+ } as TokenSecurityScheme,
+ },
+ };
+
+ const node = new XFernBasicAuthNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.username).toEqual({
+ type: "basic",
+ value: "testuser",
+ });
+ expect(node.password).toBeUndefined();
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ username: {
+ type: "basic",
+ value: "testuser",
+ },
+ password: undefined,
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicPasswordVariableNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicPasswordVariableNameConverter.node.test.ts
new file mode 100644
index 0000000000..cae4d63904
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicPasswordVariableNameConverter.node.test.ts
@@ -0,0 +1,36 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernBasicPasswordVariableNameConverterNode } from "../../auth/XFernBasicPasswordVariableNameConverter.node";
+
+describe("XFernBasicPasswordVariableNameConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse password variable name", () => {
+ const input = {
+ "x-fern-password-variable-name": "myPassword",
+ };
+
+ const node = new XFernBasicPasswordVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.passwordVariableName).toBe("myPassword");
+ expect(node.convert()).toBe("myPassword");
+ });
+
+ it("should handle missing password variable name", () => {
+ const input = {};
+
+ const node = new XFernBasicPasswordVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.passwordVariableName).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicUsernameVariableNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicUsernameVariableNameConverter.node.test.ts
new file mode 100644
index 0000000000..22f44fc98b
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBasicUsernameVariableNameConverter.node.test.ts
@@ -0,0 +1,36 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernBasicUsernameVariableNameConverterNode } from "../../auth/XFernBasicUsernameVariableNameConverter.node";
+
+describe("XFernBasicUsernameVariableNameConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse username variable name", () => {
+ const input = {
+ "x-fern-username-variable-name": "myUsername",
+ };
+
+ const node = new XFernBasicUsernameVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.usernameVariableName).toBe("myUsername");
+ expect(node.convert()).toBe("myUsername");
+ });
+
+ it("should handle missing username variable name", () => {
+ const input = {};
+
+ const node = new XFernBasicUsernameVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.usernameVariableName).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerFormatConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerFormatConverter.node.test.ts
new file mode 100644
index 0000000000..c6d025f310
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerFormatConverter.node.test.ts
@@ -0,0 +1,36 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XBearerFormatConverterNode } from "../../auth/XBearerFormatConverter.node";
+
+describe("XBearerFormatConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse bearer format", () => {
+ const input = {
+ "x-bearer-format": "JWT",
+ };
+
+ const node = new XBearerFormatConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.bearerFormat).toBe("JWT");
+ expect(node.convert()).toBe("JWT");
+ });
+
+ it("should handle missing bearer format", () => {
+ const input = {};
+
+ const node = new XBearerFormatConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.bearerFormat).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenConverter.node.test.ts
new file mode 100644
index 0000000000..366e6fcf39
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenConverter.node.test.ts
@@ -0,0 +1,76 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernBearerTokenConverterNode } from "../../auth/XFernBearerTokenConverter.node";
+import { TokenSecurityScheme } from "../../auth/types/TokenSecurityScheme";
+
+describe("XFernBearerTokenConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse bearer token with name and env", () => {
+ const input = {
+ "x-fern-bearer": {
+ name: "myToken",
+ env: "MY_TOKEN_ENV",
+ } as TokenSecurityScheme,
+ };
+
+ const node = new XFernBearerTokenConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.bearerTokenVariableName).toBe("myToken");
+ expect(node.bearerTokenEnvVar).toBe("MY_TOKEN_ENV");
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ tokenVariableName: "myToken",
+ tokenEnvVar: "MY_TOKEN_ENV",
+ });
+ });
+
+ it("should handle missing bearer token", () => {
+ const input = {};
+
+ const node = new XFernBearerTokenConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.bearerTokenVariableName).toBeUndefined();
+ expect(node.bearerTokenEnvVar).toBeUndefined();
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ tokenVariableName: undefined,
+ tokenEnvVar: undefined,
+ });
+ });
+
+ it("should handle partial bearer token info", () => {
+ const input = {
+ "x-fern-bearer": {
+ name: "myToken",
+ } as TokenSecurityScheme,
+ };
+
+ const node = new XFernBearerTokenConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.bearerTokenVariableName).toBe("myToken");
+ expect(node.bearerTokenEnvVar).toBeUndefined();
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ tokenVariableName: "myToken",
+ tokenEnvVar: undefined,
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenVariableNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenVariableNameConverter.node.test.ts
new file mode 100644
index 0000000000..c1fce63efa
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernBearerTokenVariableNameConverter.node.test.ts
@@ -0,0 +1,36 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernBearerTokenVariableNameConverterNode } from "../../auth/XFernBearerTokenVariableNameConverter.node";
+
+describe("XFernBearerTokenVariableNameConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse token variable name", () => {
+ const input = {
+ "x-fern-token-variable-name": "myToken",
+ };
+
+ const node = new XFernBearerTokenVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.tokenVariableName).toBe("myToken");
+ expect(node.convert()).toBe("myToken");
+ });
+
+ it("should handle missing token variable name", () => {
+ const input = {};
+
+ const node = new XFernBearerTokenVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.tokenVariableName).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderAuthConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderAuthConverter.node.test.ts
new file mode 100644
index 0000000000..f476927b71
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderAuthConverter.node.test.ts
@@ -0,0 +1,84 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernHeaderAuthConverterNode } from "../../auth/XFernHeaderAuthConverter.node";
+import { HeaderTokenSecurityScheme } from "../../auth/types/TokenSecurityScheme";
+
+describe("XFernHeaderAuthConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse header auth with name, env and prefix", () => {
+ const input = {
+ "x-fern-header": {
+ name: "myHeader",
+ env: "MY_HEADER_ENV",
+ prefix: "Bearer",
+ } as HeaderTokenSecurityScheme,
+ };
+
+ const node = new XFernHeaderAuthConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.headerVariableName).toBe("myHeader");
+ expect(node.headerEnvVar).toBe("MY_HEADER_ENV");
+ expect(node.headerPrefix).toBe("Bearer");
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ name: "myHeader",
+ env: "MY_HEADER_ENV",
+ prefix: "Bearer",
+ });
+ });
+
+ it("should handle missing header auth", () => {
+ const input = {};
+
+ const node = new XFernHeaderAuthConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.headerVariableName).toBeUndefined();
+ expect(node.headerEnvVar).toBeUndefined();
+ expect(node.headerPrefix).toBeUndefined();
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ name: undefined,
+ env: undefined,
+ prefix: undefined,
+ });
+ });
+
+ it("should handle partial header auth info", () => {
+ const input = {
+ "x-fern-header": {
+ name: "myHeader",
+ prefix: "Bearer",
+ } as HeaderTokenSecurityScheme,
+ };
+
+ const node = new XFernHeaderAuthConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.headerVariableName).toBe("myHeader");
+ expect(node.headerEnvVar).toBeUndefined();
+ expect(node.headerPrefix).toBe("Bearer");
+
+ const converted = node.convert();
+ expect(converted).toEqual({
+ name: "myHeader",
+ env: undefined,
+ prefix: "Bearer",
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderVariableNameConverter.node.test.ts b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderVariableNameConverter.node.test.ts
new file mode 100644
index 0000000000..25fb446827
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/__test__/auth/XFernHeaderVariableNameConverter.node.test.ts
@@ -0,0 +1,36 @@
+import { createMockContext } from "../../../../../__test__/createMockContext.util";
+import { XFernHeaderVariableNameConverterNode } from "../../auth/XFernHeaderVariableNameConverter.node";
+
+describe("XFernHeaderVariableNameConverterNode", () => {
+ const mockContext = createMockContext();
+
+ it("should parse header variable name", () => {
+ const input = {
+ "x-fern-header-variable-name": "myHeader",
+ };
+
+ const node = new XFernHeaderVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.headerVariableName).toBe("myHeader");
+ expect(node.convert()).toBe("myHeader");
+ });
+
+ it("should handle missing header variable name", () => {
+ const input = {};
+
+ const node = new XFernHeaderVariableNameConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.headerVariableName).toBeUndefined();
+ expect(node.convert()).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XBearerFormatConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XBearerFormatConverter.node.ts
new file mode 100644
index 0000000000..2976002fbd
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XBearerFormatConverter.node.ts
@@ -0,0 +1,29 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xBearerFormatKey } from "../openApiExtension.consts";
+
+export declare namespace XBearerFormatConverterNode {
+ export interface Input {
+ [xBearerFormatKey]?: string;
+ }
+}
+
+export class XBearerFormatConverterNode extends BaseOpenApiV3_1ConverterNode {
+ bearerFormat: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.bearerFormat = extendType(this.input)[xBearerFormatKey];
+ }
+
+ convert(): string | undefined {
+ return this.bearerFormat;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernAccessTokenLocatorConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernAccessTokenLocatorConverter.node.ts
new file mode 100644
index 0000000000..ddc382ce6e
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernAccessTokenLocatorConverter.node.ts
@@ -0,0 +1,41 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { isValidJsonPath } from "../../../utils/isValidJsonPath";
+import { xFernAccessTokenLocatorKey } from "../fernExtension.consts";
+
+export declare namespace XFernAccessTokenLocatorConverterNode {
+ export interface Input {
+ [xFernAccessTokenLocatorKey]?: string;
+ }
+}
+
+export class XFernAccessTokenLocatorConverterNode extends BaseOpenApiV3_1ConverterNode {
+ accessTokenLocator: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.accessTokenLocator = extendType(this.input)[
+ xFernAccessTokenLocatorKey
+ ];
+ if (this.accessTokenLocator != null) {
+ if (!isValidJsonPath(this.accessTokenLocator)) {
+ this.context.errors.error({
+ message: "Invalid access token locator, must be a valid jq path",
+ path: this.accessPath,
+ });
+ this.accessTokenLocator = undefined;
+ }
+ }
+ }
+
+ convert(): string | undefined {
+ return this.accessTokenLocator;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicAuth.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicAuth.node.ts
new file mode 100644
index 0000000000..d023203476
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicAuth.node.ts
@@ -0,0 +1,45 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernBasicAuthKey } from "../fernExtension.consts";
+import { TokenSecurityScheme } from "./types/TokenSecurityScheme";
+
+export declare namespace XFernBasicAuthNode {
+ export interface Input {
+ [xFernBasicAuthKey]?: {
+ username?: TokenSecurityScheme;
+ password?: TokenSecurityScheme;
+ };
+ }
+
+ export interface Output {
+ username?: TokenSecurityScheme;
+ password?: TokenSecurityScheme;
+ }
+}
+
+export class XFernBasicAuthNode extends BaseOpenApiV3_1ConverterNode {
+ username: TokenSecurityScheme | undefined;
+ password: TokenSecurityScheme | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ // This would be used to set a member on the node
+ parse(): void {
+ const basicAuthScheme = extendType(this.input)[xFernBasicAuthKey];
+ this.username = basicAuthScheme?.username;
+ this.password = basicAuthScheme?.password;
+ }
+
+ convert(): XFernBasicAuthNode.Output | undefined {
+ return {
+ username: this.username,
+ password: this.password,
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicPasswordVariableNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicPasswordVariableNameConverter.node.ts
new file mode 100644
index 0000000000..2dce41749f
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicPasswordVariableNameConverter.node.ts
@@ -0,0 +1,31 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernBasicPasswordVariableNameKey } from "../fernExtension.consts";
+
+export declare namespace XFernBasicPasswordVariableNameConverterNode {
+ export interface Input {
+ [xFernBasicPasswordVariableNameKey]?: string;
+ }
+}
+
+export class XFernBasicPasswordVariableNameConverterNode extends BaseOpenApiV3_1ConverterNode {
+ passwordVariableName: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.passwordVariableName = extendType(this.input)[
+ xFernBasicPasswordVariableNameKey
+ ];
+ }
+
+ convert(): string | undefined {
+ return this.passwordVariableName;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicUsernameVariableNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicUsernameVariableNameConverter.node.ts
new file mode 100644
index 0000000000..5da791dc2d
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBasicUsernameVariableNameConverter.node.ts
@@ -0,0 +1,31 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernBasicUsernameVariableNameKey } from "../fernExtension.consts";
+
+export declare namespace XFernBasicUsernameVariableNameConverterNode {
+ export interface Input {
+ [xFernBasicUsernameVariableNameKey]?: string;
+ }
+}
+
+export class XFernBasicUsernameVariableNameConverterNode extends BaseOpenApiV3_1ConverterNode {
+ usernameVariableName: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.usernameVariableName = extendType(this.input)[
+ xFernBasicUsernameVariableNameKey
+ ];
+ }
+
+ convert(): string | undefined {
+ return this.usernameVariableName;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenConverter.node.ts
new file mode 100644
index 0000000000..fd74e39d19
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenConverter.node.ts
@@ -0,0 +1,44 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernBearerTokenKey } from "../fernExtension.consts";
+import { TokenSecurityScheme } from "./types/TokenSecurityScheme";
+
+export declare namespace XFernBearerTokenConverterNode {
+ export interface Input {
+ [xFernBearerTokenKey]?: TokenSecurityScheme;
+ }
+
+ export interface Output {
+ tokenVariableName?: string;
+ tokenEnvVar?: string;
+ }
+}
+
+export class XFernBearerTokenConverterNode extends BaseOpenApiV3_1ConverterNode<
+ unknown,
+ XFernBearerTokenConverterNode.Output
+> {
+ bearerTokenVariableName: string | undefined;
+ bearerTokenEnvVar: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ const bearerToken = extendType(this.input)[xFernBearerTokenKey];
+ this.bearerTokenVariableName = bearerToken?.name;
+ this.bearerTokenEnvVar = bearerToken?.env;
+ }
+
+ convert(): XFernBearerTokenConverterNode.Output | undefined {
+ return {
+ tokenVariableName: this.bearerTokenVariableName,
+ tokenEnvVar: this.bearerTokenEnvVar,
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenVariableNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenVariableNameConverter.node.ts
new file mode 100644
index 0000000000..9effdc9124
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernBearerTokenVariableNameConverter.node.ts
@@ -0,0 +1,31 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernBearerTokenVariableNameKey } from "../fernExtension.consts";
+
+export declare namespace XFernBearerTokenVariableNameConverterNode {
+ export interface Input {
+ [xFernBearerTokenVariableNameKey]?: string;
+ }
+}
+
+export class XFernBearerTokenVariableNameConverterNode extends BaseOpenApiV3_1ConverterNode {
+ tokenVariableName: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.tokenVariableName = extendType(this.input)[
+ xFernBearerTokenVariableNameKey
+ ];
+ }
+
+ convert(): string | undefined {
+ return this.tokenVariableName;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderAuthConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderAuthConverter.node.ts
new file mode 100644
index 0000000000..342868eeae
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderAuthConverter.node.ts
@@ -0,0 +1,39 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernHeaderAuthKey } from "../fernExtension.consts";
+import { HeaderTokenSecurityScheme } from "./types/TokenSecurityScheme";
+
+export declare namespace XFernHeaderAuthConverterNode {
+ export interface Input {
+ [xFernHeaderAuthKey]?: HeaderTokenSecurityScheme;
+ }
+}
+
+export class XFernHeaderAuthConverterNode extends BaseOpenApiV3_1ConverterNode {
+ headerVariableName: string | undefined;
+ headerEnvVar: string | undefined;
+ headerPrefix: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ const headerAuth = extendType(this.input)[xFernHeaderAuthKey];
+ this.headerVariableName = headerAuth?.name;
+ this.headerEnvVar = headerAuth?.env;
+ this.headerPrefix = headerAuth?.prefix;
+ }
+
+ convert(): HeaderTokenSecurityScheme | undefined {
+ return {
+ name: this.headerVariableName,
+ env: this.headerEnvVar,
+ prefix: this.headerPrefix,
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderVariableNameConverter.node.ts b/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderVariableNameConverter.node.ts
new file mode 100644
index 0000000000..11b0b17a87
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/XFernHeaderVariableNameConverter.node.ts
@@ -0,0 +1,31 @@
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../../BaseOpenApiV3_1Converter.node";
+import { extendType } from "../../../utils/extendType";
+import { xFernHeaderVariableNameKey } from "../fernExtension.consts";
+
+export declare namespace XFernHeaderVariableNameConverterNode {
+ export interface Input {
+ [xFernHeaderVariableNameKey]?: string;
+ }
+}
+
+export class XFernHeaderVariableNameConverterNode extends BaseOpenApiV3_1ConverterNode {
+ headerVariableName: string | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.headerVariableName = extendType(this.input)[
+ xFernHeaderVariableNameKey
+ ];
+ }
+
+ convert(): string | undefined {
+ return this.headerVariableName;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/auth/types/TokenSecurityScheme.ts b/packages/parsers/src/openapi/3.1/extensions/auth/types/TokenSecurityScheme.ts
new file mode 100644
index 0000000000..3aac26e325
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/auth/types/TokenSecurityScheme.ts
@@ -0,0 +1,8 @@
+export interface TokenSecurityScheme {
+ name?: string;
+ env?: string;
+}
+
+export interface HeaderTokenSecurityScheme extends TokenSecurityScheme {
+ prefix?: string;
+}
diff --git a/packages/parsers/src/openapi/3.1/extensions/fernExtension.consts.ts b/packages/parsers/src/openapi/3.1/extensions/fernExtension.consts.ts
new file mode 100644
index 0000000000..9deb5819cd
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/fernExtension.consts.ts
@@ -0,0 +1,13 @@
+export const xFernBasePathKey = "x-fern-base-path";
+export const xFernAvailabilityKey = "x-fern-availability";
+export const xFernGroupNameKey = "x-fern-sdk-group-name";
+export const xFernGroupsKey = "x-fern-groups";
+export const xFernWebhookKey = "x-fern-webhook";
+export const xFernAccessTokenLocatorKey = "x-fern-access-token-locator";
+export const xFernBasicAuthKey = "x-fern-basic";
+export const xFernBasicUsernameVariableNameKey = "x-fern-username-variable-name";
+export const xFernBasicPasswordVariableNameKey = "x-fern-password-variable-name";
+export const xFernBearerTokenKey = "x-fern-bearer";
+export const xFernBearerTokenVariableNameKey = "x-fern-token-variable-name";
+export const xFernHeaderAuthKey = "x-fern-header";
+export const xFernHeaderVariableNameKey = "x-fern-header-variable-name";
diff --git a/packages/parsers/src/openapi/3.1/extensions/openApiExtension.consts.ts b/packages/parsers/src/openapi/3.1/extensions/openApiExtension.consts.ts
new file mode 100644
index 0000000000..cddcd4225a
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/extensions/openApiExtension.consts.ts
@@ -0,0 +1 @@
+export const xBearerFormatKey = "x-bearer-format";
diff --git a/packages/parsers/src/openapi/3.1/guards/__test__/isApiKeySecurityScheme.test.ts b/packages/parsers/src/openapi/3.1/guards/__test__/isApiKeySecurityScheme.test.ts
new file mode 100644
index 0000000000..17f185e1b9
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/__test__/isApiKeySecurityScheme.test.ts
@@ -0,0 +1,34 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { isApiKeySecurityScheme } from "../isApiKeySecurityScheme";
+
+describe("isApiKeySecurityScheme", () => {
+ it("returns true for API key security scheme", () => {
+ const input: OpenAPIV3_1.SecuritySchemeObject = {
+ type: "apiKey",
+ name: "api_key",
+ in: "header",
+ };
+ expect(isApiKeySecurityScheme(input)).toBe(true);
+ });
+
+ it("returns false for other security scheme types", () => {
+ const inputs: OpenAPIV3_1.SecuritySchemeObject[] = [
+ {
+ type: "http",
+ scheme: "basic",
+ },
+ {
+ type: "oauth2",
+ flows: {},
+ },
+ {
+ type: "openIdConnect",
+ openIdConnectUrl: "https://example.com/.well-known/openid-configuration",
+ },
+ ];
+
+ for (const input of inputs) {
+ expect(isApiKeySecurityScheme(input)).toBe(false);
+ }
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/guards/__test__/isInHeader.test.ts b/packages/parsers/src/openapi/3.1/guards/__test__/isInHeader.test.ts
new file mode 100644
index 0000000000..bbc4709579
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/__test__/isInHeader.test.ts
@@ -0,0 +1,33 @@
+import { isInHeader } from "../isInHeader";
+
+describe("isInHeader", () => {
+ it("returns true when input has in: 'header'", () => {
+ const input = { in: "header" };
+ expect(isInHeader(input)).toBe(true);
+ });
+
+ it("returns false when input has different 'in' value", () => {
+ const input = { in: "query" };
+ expect(isInHeader(input)).toBe(false);
+ });
+
+ it("returns false when input is missing 'in' property", () => {
+ const input = { foo: "bar" };
+ expect(isInHeader(input)).toBe(false);
+ });
+
+ it("returns false when input is null", () => {
+ expect(isInHeader(null)).toBe(false);
+ });
+
+ it("returns false when input is undefined", () => {
+ expect(isInHeader(undefined)).toBe(false);
+ });
+
+ it("returns false when input is not an object", () => {
+ const inputs = [123, "string", true, []];
+ for (const input of inputs) {
+ expect(isInHeader(input)).toBe(false);
+ }
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/guards/isApiKeySecurityScheme.ts b/packages/parsers/src/openapi/3.1/guards/isApiKeySecurityScheme.ts
new file mode 100644
index 0000000000..c555961dfc
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/isApiKeySecurityScheme.ts
@@ -0,0 +1,7 @@
+import { OpenAPIV3_1 } from "openapi-types";
+
+export function isApiKeySecurityScheme(
+ input: OpenAPIV3_1.SecuritySchemeObject,
+): input is OpenAPIV3_1.ApiKeySecurityScheme {
+ return input.type === "apiKey";
+}
diff --git a/packages/parsers/src/openapi/3.1/guards/isInHeader.ts b/packages/parsers/src/openapi/3.1/guards/isInHeader.ts
new file mode 100644
index 0000000000..a4222440a1
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/isInHeader.ts
@@ -0,0 +1,5 @@
+export function isInHeader(input: unknown): input is {
+ in: "header";
+} {
+ return typeof input === "object" && input != null && "in" in input && input.in === "header";
+}
diff --git a/packages/parsers/src/openapi/3.1/guards/isMixedSchema.ts b/packages/parsers/src/openapi/3.1/guards/isMixedSchema.ts
new file mode 100644
index 0000000000..a03881ced3
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/isMixedSchema.ts
@@ -0,0 +1,10 @@
+import { MixedSchemaConverterNode } from "../schemas/MixedSchemaConverter.node";
+import { isArraySchema } from "./isArraySchema";
+import { isNonArraySchema } from "./isNonArraySchema";
+
+export function isMixedSchema(schema: unknown): schema is MixedSchemaConverterNode.Input {
+ return (
+ Array.isArray(schema) &&
+ schema.every((type) => type.type === "null" || isNonArraySchema(type) || isArraySchema(type))
+ );
+}
diff --git a/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts b/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts
new file mode 100644
index 0000000000..da08093d9e
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/guards/isWebhookDefinition.ts
@@ -0,0 +1,7 @@
+import { FernRegistry } from "../../../client/generated";
+
+export function isWebhookDefinition(
+ definition: FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition,
+): definition is FernRegistry.api.latest.WebhookDefinition {
+ return "payload" in definition;
+}
diff --git a/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts
index 51386fa17b..e52b3bc919 100644
--- a/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/OperationObjectConverter.node.ts
@@ -6,19 +6,24 @@ import {
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../../BaseOpenApiV3_1Converter.node";
import { coalesceServers } from "../../utils/3.1/coalesceServers";
-import { convertToObjectProperties } from "../../utils/3.1/convertToObjectProperties";
import { resolveParameterReference } from "../../utils/3.1/resolveParameterReference";
+import { getEndpointId } from "../../utils/getEndpointId";
+import { SecurityRequirementObjectConverterNode } from "../auth/SecurityRequirementObjectConverter.node";
import { AvailabilityConverterNode } from "../extensions/AvailabilityConverter.node";
import { XFernBasePathConverterNode } from "../extensions/XFernBasePathConverter.node";
+import { XFernGroupNameConverterNode } from "../extensions/XFernGroupNameConverter.node";
import { isReferenceObject } from "../guards/isReferenceObject";
import { ServerObjectConverterNode } from "./ServerObjectConverter.node";
-import { ParameterBaseObjectConverterNode } from "./parameters/ParameterBaseObjectConverter.node";
+import {
+ ParameterBaseObjectConverterNode,
+ convertOperationObjectProperties,
+} from "./parameters/ParameterBaseObjectConverter.node";
import { RequestBodyObjectConverterNode } from "./request/RequestBodyObjectConverter.node";
import { ResponsesObjectConverterNode } from "./response/ResponsesObjectConverter.node";
export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
OpenAPIV3_1.OperationObject,
- FernRegistry.api.latest.EndpointDefinition
+ FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition
> {
description: string | undefined;
pathParameters: Record | undefined;
@@ -27,6 +32,8 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
requests: RequestBodyObjectConverterNode | undefined;
responses: ResponsesObjectConverterNode | undefined;
availability: AvailabilityConverterNode | undefined;
+ auth: SecurityRequirementObjectConverterNode | undefined;
+ namespace: XFernGroupNameConverterNode | undefined;
constructor(
args: BaseOpenApiV3_1ConverterNodeConstructorArgs,
@@ -34,12 +41,21 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
protected path: string | undefined,
protected method: "GET" | "POST" | "PUT" | "DELETE",
protected basePath: XFernBasePathConverterNode | undefined,
+ protected isWebhook?: boolean,
) {
super(args);
this.safeParse();
}
parse(): void {
+ if (this.isWebhook && this.method !== "POST" && this.method !== "GET") {
+ this.context.errors.error({
+ message: `Webhook method must be POST or GET. Received: ${this.method}`,
+ path: this.accessPath,
+ });
+ return;
+ }
+
this.description = this.input.description;
this.availability = new AvailabilityConverterNode({
input: this.input,
@@ -95,7 +111,15 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
}
}
});
- // validate path parts
+
+ for (const pathParameterId of this.extractPathParameterIds() ?? []) {
+ if (this.pathParameters?.[pathParameterId] == null) {
+ this.context.errors.warning({
+ message: `Path parameter not defined: ${pathParameterId}`,
+ path: [...this.accessPath, "parameters"],
+ });
+ }
+ }
this.requests =
this.input.requestBody != null
@@ -116,6 +140,38 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
pathId: "responses",
})
: undefined;
+
+ if (this.input.security != null) {
+ this.auth = new SecurityRequirementObjectConverterNode({
+ input: this.input.security,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "security",
+ });
+ }
+
+ this.namespace = new XFernGroupNameConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "x-fern-group-name",
+ });
+ }
+
+ extractPathParameterIds(): string[] | undefined {
+ if (this.path == null) {
+ return undefined;
+ }
+
+ return this.path
+ .split("/")
+ .map((part) => {
+ if (part.startsWith("{") && part.endsWith("}")) {
+ return part.slice(1, -1).trim();
+ }
+ return undefined;
+ })
+ .filter(isNonNullish);
}
convertPathToPathParts(): FernRegistry.api.latest.PathPart[] | undefined {
@@ -141,12 +197,32 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
});
}
- convert(): FernRegistry.api.latest.EndpointDefinition | undefined {
+ convert(): FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition | undefined {
if (this.path == null) {
return undefined;
}
- const endpointId = this.path;
+ if (this.isWebhook) {
+ if (this.method !== "POST" && this.method !== "GET") {
+ return undefined;
+ }
+
+ return {
+ description: this.description,
+ availability: this.availability?.convert(),
+ namespace: this.namespace?.convert(),
+ id: FernRegistry.WebhookId("x-fern-webhook-name"),
+ method: this.method,
+ // This is a little bit weird, consider changing the shape of fdr
+ path: this.convertPathToPathParts()?.map((part) => part.value.toString()) ?? [],
+ headers: convertOperationObjectProperties(this.requestHeaders),
+ // TODO: figure out what this looks like to be able to parse
+ payload: undefined,
+ examples: undefined,
+ };
+ }
+
+ const endpointId = getEndpointId(this.method, this.path);
const environments = this.servers?.map((server) => server.convert()).filter(isNonNullish);
const pathParts = this.convertPathToPathParts();
@@ -154,6 +230,12 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
return undefined;
}
+ let authIds: string[] | undefined;
+ const auth = this.auth?.convert();
+ if (auth != null) {
+ authIds = Object.keys(auth);
+ }
+
// TODO: revisit fdr shape to suport multiple responses
const { responses, errors } = this.responses?.convert() ?? { responses: undefined, errors: undefined };
@@ -161,22 +243,22 @@ export class OperationObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
return {
description: this.description,
availability: this.availability?.convert(),
- namespace: undefined,
+ namespace: this.namespace?.convert(),
id: FernRegistry.EndpointId(endpointId),
method: this.method,
path: pathParts,
- // TODO: auth
- auth: undefined,
+ auth: authIds?.map((id) => FernRegistry.api.latest.AuthSchemeId(id)),
defaultEnvironment: environments?.[0]?.id,
environments,
- pathParameters: convertToObjectProperties(this.pathParameters),
- queryParameters: convertToObjectProperties(this.queryParameters),
- requestHeaders: convertToObjectProperties(this.requestHeaders),
+ pathParameters: convertOperationObjectProperties(this.pathParameters),
+ queryParameters: convertOperationObjectProperties(this.queryParameters),
+ requestHeaders: convertOperationObjectProperties(this.requestHeaders),
responseHeaders: responses?.[0]?.headers,
// TODO: revisit fdr shape to suport multiple requests
request: this.requests?.convert()[0],
response: responses?.[0]?.response,
errors,
+ // TODO: examples
examples: [],
snippetTemplates: undefined,
};
diff --git a/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts
index e35af58f6e..84fbe034fd 100644
--- a/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/PathItemObjectConverter.node.ts
@@ -7,16 +7,15 @@ import {
} from "../../BaseOpenApiV3_1Converter.node";
import { coalesceServers } from "../../utils/3.1/coalesceServers";
import { XFernBasePathConverterNode } from "../extensions/XFernBasePathConverter.node";
+import { XFernWebhookConverterNode } from "../extensions/XFernWebhookConverter.node";
import { OperationObjectConverterNode } from "./OperationObjectConverter.node";
import { ServerObjectConverterNode } from "./ServerObjectConverter.node";
export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
OpenAPIV3_1.PathItemObject,
- FernRegistry.api.latest.EndpointDefinition[]
+ (FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition)[]
> {
description: string | undefined;
- // TODO: Implement this
- // availability: AvailabilityConverterNode | undefined;
get: OperationObjectConverterNode | undefined;
post: OperationObjectConverterNode | undefined;
put: OperationObjectConverterNode | undefined;
@@ -28,12 +27,21 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
args: BaseOpenApiV3_1ConverterNodeConstructorArgs,
protected servers: ServerObjectConverterNode[] | undefined,
protected basePath: XFernBasePathConverterNode | undefined,
+ protected isWebhook: boolean | undefined,
) {
super(args);
this.safeParse();
}
parse(): void {
+ const isWebhook =
+ new XFernWebhookConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ }).isWebhook || this.isWebhook;
+
this.description = this.input.description;
this.servers = coalesceServers(this.servers, this.input.servers, this.context, this.accessPath);
@@ -49,6 +57,7 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
this.pathId,
"GET",
this.basePath,
+ isWebhook,
);
}
if (this.input.post != null) {
@@ -63,6 +72,7 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
this.pathId,
"POST",
this.basePath,
+ isWebhook,
);
}
if (this.input.put != null) {
@@ -93,13 +103,9 @@ export class PathItemObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
this.basePath,
);
}
-
- this.input.parameters;
-
- // validate if path parts and path parameters match
}
- convert(): FernRegistry.api.latest.EndpointDefinition[] | undefined {
+ convert(): (FernRegistry.api.latest.EndpointDefinition | FernRegistry.api.latest.WebhookDefinition)[] | undefined {
return [this.get?.convert(), this.post?.convert(), this.put?.convert(), this.delete?.convert()].filter(
isNonNullish,
);
diff --git a/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts
index 6c70a1e09a..0e5837775c 100644
--- a/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/PathsObjectConverter.node.ts
@@ -1,6 +1,5 @@
import { isNonNullish } from "@fern-api/ui-core-utils";
import { OpenAPIV3_1 } from "openapi-types";
-import { v4 } from "uuid";
import { FernRegistry } from "../../../client/generated";
import {
BaseOpenApiV3_1ConverterNode,
@@ -8,12 +7,20 @@ import {
} from "../../BaseOpenApiV3_1Converter.node";
import { coalesceServers } from "../../utils/3.1/coalesceServers";
import { XFernBasePathConverterNode } from "../extensions/XFernBasePathConverter.node";
+import { isWebhookDefinition } from "../guards/isWebhookDefinition";
import { PathItemObjectConverterNode } from "./PathItemObjectConverter.node";
import { ServerObjectConverterNode } from "./ServerObjectConverter.node";
+export declare namespace PathsObjectConverterNode {
+ export interface Output {
+ endpoints: Record;
+ webhookEndpoints: Record;
+ }
+}
+
export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
OpenAPIV3_1.PathsObject,
- Record
+ PathsObjectConverterNode.Output
> {
paths: PathItemObjectConverterNode[] | undefined;
@@ -25,6 +32,7 @@ export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
super(args);
this.safeParse();
}
+
parse(): void {
this.paths = Object.entries(this.input)
.map(([path, pathItem]) => {
@@ -40,30 +48,38 @@ export class PathsObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
},
coalesceServers(this.servers, pathItem.servers, this.context, this.accessPath),
this.basePath,
+ undefined,
);
})
.filter(isNonNullish);
}
- convert(): Record | undefined {
+ convert(): PathsObjectConverterNode.Output | undefined {
if (this.paths == null) {
return undefined;
}
- return Object.fromEntries(
- Object.values(this.paths)
- .flatMap((pathItem) => {
- const endpointDefinitions = pathItem.convert();
- if (endpointDefinitions == null) {
- return undefined;
- }
+ const endpoints: Record = {};
+ const webhookEndpoints: Record = {};
+
+ this.paths.forEach((pathItem) => {
+ const pathItemDefinitions = pathItem.convert();
+ if (pathItemDefinitions == null) {
+ return undefined;
+ }
+
+ pathItemDefinitions.forEach((definition) => {
+ if (isWebhookDefinition(definition)) {
+ webhookEndpoints[FernRegistry.WebhookId(definition.id)] = definition;
+ } else {
+ endpoints[FernRegistry.EndpointId(definition.id)] = definition;
+ }
+ });
+ });
- return endpointDefinitions.map((endpointDefinition) => [
- FernRegistry.EndpointId(v4()),
- endpointDefinition,
- ]);
- })
- .filter(isNonNullish),
- );
+ return {
+ endpoints,
+ webhookEndpoints,
+ };
}
}
diff --git a/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts
index a434825505..3c3bd3c6ae 100644
--- a/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/WebhooksObjectConverter.node.ts
@@ -1 +1,57 @@
-// TODO: This is not strictly typed, but the reference objects in this case refer to schemas for endpoints, likely listed in paths, so will need to think about how to disambiguate, or represent
+import { OpenAPIV3_1 } from "openapi-types";
+
+import { isNonNullish } from "@fern-api/ui-core-utils";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { resolveWebhookReference } from "../../utils/3.1/resolveWebhookReference";
+import { XFernBasePathConverterNode } from "../extensions/XFernBasePathConverter.node";
+import { PathItemObjectConverterNode } from "./PathItemObjectConverter.node";
+
+export class WebhooksObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
+ OpenAPIV3_1.Document["webhooks"],
+ FernRegistry.api.latest.ApiDefinition["webhooks"]
+> {
+ webhooks: Record | undefined;
+
+ constructor(
+ args: BaseOpenApiV3_1ConverterNodeConstructorArgs,
+ protected readonly basePath: XFernBasePathConverterNode | undefined,
+ ) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ this.webhooks = Object.fromEntries(
+ Object.entries(this.input ?? {})
+ .map(([operation, operationItem]) => {
+ const resolvedOperationItem = resolveWebhookReference(operationItem, this.context.document);
+ if (resolvedOperationItem == null) {
+ return undefined;
+ }
+ return [
+ operation,
+ new PathItemObjectConverterNode(
+ {
+ input: resolvedOperationItem,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: operation,
+ },
+ undefined,
+ this.basePath,
+ true,
+ ),
+ ];
+ })
+ .filter(isNonNullish),
+ );
+ }
+
+ convert(): FernRegistry.api.latest.ApiDefinition["webhooks"] | undefined {
+ return {};
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/paths/__test__/OperationObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/paths/__test__/OperationObjectConverter.node.test.ts
index 67995e19b5..5ed514fcd7 100644
--- a/packages/parsers/src/openapi/3.1/paths/__test__/OperationObjectConverter.node.test.ts
+++ b/packages/parsers/src/openapi/3.1/paths/__test__/OperationObjectConverter.node.test.ts
@@ -36,7 +36,7 @@ describe("OperationObjectConverterNode", () => {
expect(result).toEqual({
description: "Get a pet",
- id: FernRegistry.EndpointId("/pets/{petId}"),
+ id: "get-pets-pet-id",
method: "GET",
path: [
{ type: "literal", value: "pets" },
@@ -49,9 +49,15 @@ describe("OperationObjectConverterNode", () => {
valueShape: {
type: "alias",
value: {
- type: "primitive",
- value: {
- type: "string",
+ type: "optional",
+ shape: {
+ type: "alias",
+ value: {
+ type: "primitive",
+ value: {
+ type: "string",
+ },
+ },
},
},
},
diff --git a/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts
index f832fb73c8..62e505b094 100644
--- a/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts
+++ b/packages/parsers/src/openapi/3.1/paths/__test__/PathItemObjectConverter.node.test.ts
@@ -43,6 +43,7 @@ describe("PathItemObjectConverterNode", () => {
},
undefined,
undefined,
+ undefined,
);
const result = node.convert();
@@ -50,7 +51,7 @@ describe("PathItemObjectConverterNode", () => {
expect(result).toHaveLength(2);
expect(result?.[0]).toEqual({
description: "Get a pet",
- id: "/pets/{petId}",
+ id: "get-pets-pet-id",
method: "GET",
path: [
{
@@ -69,9 +70,15 @@ describe("PathItemObjectConverterNode", () => {
valueShape: {
type: "alias",
value: {
- type: "primitive",
- value: {
- type: "string",
+ type: "optional",
+ shape: {
+ type: "alias",
+ value: {
+ type: "primitive",
+ value: {
+ type: "string",
+ },
+ },
},
},
},
@@ -82,7 +89,7 @@ describe("PathItemObjectConverterNode", () => {
});
expect(result?.[1]).toEqual({
description: "Create a pet",
- id: "/pets/{petId}",
+ id: "post-pets-pet-id",
method: "POST",
path: [
{
@@ -114,6 +121,7 @@ describe("PathItemObjectConverterNode", () => {
},
undefined,
undefined,
+ undefined,
);
const result = node.convert();
@@ -146,6 +154,7 @@ describe("PathItemObjectConverterNode", () => {
},
undefined,
undefined,
+ undefined,
);
const result = node.convert();
diff --git a/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts b/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts
index 4db7550ee9..2ae549e5f7 100644
--- a/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts
+++ b/packages/parsers/src/openapi/3.1/paths/__test__/PathsObjectConverter.node.test.ts
@@ -48,11 +48,11 @@ describe("PathsObjectConverterNode", () => {
undefined,
);
- const result = node.convert() ?? {};
+ const result = node.convert() ?? { endpoints: {} };
expect(result).toBeDefined();
- expect(Object.keys(result)).toHaveLength(2);
- Object.values(result).forEach((endpoint) => {
+ expect(Object.keys(result.endpoints)).toHaveLength(2);
+ Object.values(result.endpoints).forEach((endpoint) => {
expect(endpoint).toEqual(
expect.objectContaining({
method: "GET",
@@ -76,7 +76,10 @@ describe("PathsObjectConverterNode", () => {
);
const result = node.convert();
- expect(result).toEqual({});
+ expect(result).toEqual({
+ endpoints: {},
+ webhookEndpoints: {},
+ });
});
it("should handle null path items", () => {
@@ -96,7 +99,10 @@ describe("PathsObjectConverterNode", () => {
);
const result = node.convert();
- expect(result).toEqual({});
+ expect(result).toEqual({
+ endpoints: {},
+ webhookEndpoints: {},
+ });
});
it("should handle paths with servers", () => {
@@ -129,9 +135,9 @@ describe("PathsObjectConverterNode", () => {
undefined,
);
- const result = node.convert() ?? {};
+ const result = node.convert() ?? { endpoints: {} };
expect(result).toBeDefined();
- expect(Object.keys(result)).toHaveLength(1);
+ expect(Object.keys(result.endpoints)).toHaveLength(1);
});
});
});
diff --git a/packages/parsers/src/openapi/3.1/paths/parameters/ParameterBaseObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/parameters/ParameterBaseObjectConverter.node.ts
index b625526c92..cfbc3cc2d6 100644
--- a/packages/parsers/src/openapi/3.1/paths/parameters/ParameterBaseObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/parameters/ParameterBaseObjectConverter.node.ts
@@ -1,13 +1,30 @@
+import { isNonNullish } from "@fern-api/ui-core-utils";
import { OpenAPIV3_1 } from "openapi-types";
import { FernRegistry } from "../../../../client/generated";
import {
BaseOpenApiV3_1ConverterNode,
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../../../BaseOpenApiV3_1Converter.node";
+import { convertToObjectProperties } from "../../../utils/3.1/convertToObjectProperties";
import { AvailabilityConverterNode } from "../../extensions/AvailabilityConverter.node";
import { isReferenceObject } from "../../guards/isReferenceObject";
import { SchemaConverterNode } from "../../schemas/SchemaConverter.node";
+export function convertOperationObjectProperties(
+ properties: Record | undefined,
+): FernRegistry.api.latest.ObjectProperty[] | undefined {
+ if (properties == null) {
+ return undefined;
+ }
+
+ return convertToObjectProperties(
+ properties,
+ Object.entries(properties ?? {})
+ .map(([key, header]) => (header.required ? key : undefined))
+ .filter(isNonNullish),
+ );
+}
+
export class ParameterBaseObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
OpenAPIV3_1.ParameterBaseObject | OpenAPIV3_1.ReferenceObject,
FernRegistry.api.latest.TypeShape
diff --git a/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts
index c22e2bf928..d7c834f92a 100644
--- a/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/paths/response/ResponsesObjectConverter.node.ts
@@ -5,7 +5,8 @@ import {
BaseOpenApiV3_1ConverterNode,
BaseOpenApiV3_1ConverterNodeConstructorArgs,
} from "../../../BaseOpenApiV3_1Converter.node";
-import { convertToObjectProperties } from "../../../utils/3.1/convertToObjectProperties";
+import { STATUS_CODE_MESSAGES } from "../../../utils/statusCodes";
+import { convertOperationObjectProperties } from "../parameters/ParameterBaseObjectConverter.node";
import { ResponseObjectConverterNode } from "./ResponseObjectConverter.node";
export class ResponsesObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
@@ -68,7 +69,7 @@ export class ResponsesObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
return undefined;
}
return {
- headers: convertToObjectProperties(response.headers),
+ headers: convertOperationObjectProperties(response.headers),
response: {
statusCode: parseInt(statusCode),
body,
@@ -97,7 +98,7 @@ export class ResponsesObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
shape,
description: response.description ?? schema.description,
availability: schema.availability?.convert(),
- name: "dummy error",
+ name: schema.name ?? STATUS_CODE_MESSAGES[parseInt(statusCode)] ?? "UNKNOWN ERROR",
examples: undefined,
};
})
diff --git a/packages/parsers/src/openapi/3.1/schemas/ConstConverter.node.ts b/packages/parsers/src/openapi/3.1/schemas/ConstConverter.node.ts
new file mode 100644
index 0000000000..321ddea13e
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/schemas/ConstConverter.node.ts
@@ -0,0 +1,63 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { AvailabilityConverterNode } from "../extensions/AvailabilityConverter.node";
+
+export class ConstConverterNode extends BaseOpenApiV3_1ConverterNode<
+ OpenAPIV3_1.SchemaObject,
+ FernRegistry.api.latest.TypeShape.Enum
+> {
+ constValue: string | undefined;
+ description: string | undefined;
+ availability: AvailabilityConverterNode | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.safeParse();
+ }
+
+ parse(): void {
+ // TODO: this can be any primitive type, so Enum Value should be an FDR primitive
+ if (
+ this.input.const != null &&
+ (typeof this.input.const === "string" ||
+ typeof this.input.const === "number" ||
+ typeof this.input.const === "boolean")
+ ) {
+ this.constValue = this.input.const.toString();
+ } else {
+ this.context.errors.warning({
+ message: `Unsupported const type: ${typeof this.input}`,
+ path: this.accessPath,
+ });
+ }
+ this.description = this.input.description;
+ this.availability = new AvailabilityConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: "x-fern-availability",
+ });
+ }
+
+ convert(): FernRegistry.api.latest.TypeShape.Enum | undefined {
+ if (this.constValue == null) {
+ return undefined;
+ }
+
+ return {
+ type: "enum",
+ default: this.constValue,
+ values: [
+ {
+ value: this.constValue,
+ description: this.description,
+ availability: this.availability?.convert(),
+ },
+ ],
+ };
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/schemas/MixedSchemaConverter.node.ts b/packages/parsers/src/openapi/3.1/schemas/MixedSchemaConverter.node.ts
new file mode 100644
index 0000000000..dcf1e79dc0
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/schemas/MixedSchemaConverter.node.ts
@@ -0,0 +1,83 @@
+import { isNonNullish } from "@fern-api/ui-core-utils";
+import { OpenAPIV3_1 } from "openapi-types";
+import { FernRegistry } from "../../../client/generated";
+import {
+ BaseOpenApiV3_1ConverterNode,
+ BaseOpenApiV3_1ConverterNodeConstructorArgs,
+} from "../../BaseOpenApiV3_1Converter.node";
+import { SchemaConverterNode } from "./SchemaConverter.node";
+
+export declare namespace MixedSchemaConverterNode {
+ export type Input = (OpenAPIV3_1.ArraySchemaObject | OpenAPIV3_1.NonArraySchemaObject | { type: "null" })[];
+}
+
+export class MixedSchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
+ MixedSchemaConverterNode.Input,
+ FernRegistry.api.latest.TypeShape.UndiscriminatedUnion | FernRegistry.api.latest.TypeShape.Alias
+> {
+ typeNodes: SchemaConverterNode[] | undefined;
+ nullable: boolean | undefined;
+
+ constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
+ super(args);
+ this.parse();
+ }
+
+ parse(): void {
+ this.typeNodes = this.input
+ .map((type) => {
+ if (type.type === "null") {
+ this.nullable = true;
+ } else {
+ return new SchemaConverterNode({
+ input: type,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ }
+ return undefined;
+ })
+ .filter(isNonNullish);
+ }
+
+ public convert():
+ | FernRegistry.api.latest.TypeShape.UndiscriminatedUnion
+ | FernRegistry.api.latest.TypeShape.Alias
+ | undefined {
+ if (this.typeNodes == null) {
+ return undefined;
+ }
+
+ const union = {
+ type: "undiscriminatedUnion",
+ variants: this.typeNodes
+ .map((typeNode) => {
+ const shape = typeNode.convert();
+ if (shape == null) {
+ return undefined;
+ }
+
+ return {
+ displayName: typeNode.name,
+ shape,
+ description: typeNode.description,
+ availability: typeNode.availability?.convert(),
+ };
+ })
+ .filter(isNonNullish),
+ } as const;
+
+ // TODO: right now, this is handled as an optional, but we should handle it as nullable
+ return this.nullable
+ ? {
+ type: "alias",
+ value: {
+ type: "optional",
+ default: union.variants[0],
+ shape: union,
+ },
+ }
+ : union;
+ }
+}
diff --git a/packages/parsers/src/openapi/3.1/schemas/ObjectConverter.node.ts b/packages/parsers/src/openapi/3.1/schemas/ObjectConverter.node.ts
index 15b1c3852e..b81a3f77f4 100644
--- a/packages/parsers/src/openapi/3.1/schemas/ObjectConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/schemas/ObjectConverter.node.ts
@@ -24,6 +24,7 @@ export class ObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
extends: string[] = [];
properties: Record | undefined;
extraProperties: string | SchemaConverterNode | undefined;
+ requiredProperties: string[] | undefined;
constructor(args: BaseOpenApiV3_1ConverterNodeConstructorArgs) {
super(args);
@@ -33,6 +34,7 @@ export class ObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
parse(): void {
this.extends = [];
+ this.requiredProperties = this.input.required;
this.properties = Object.fromEntries(
Object.entries(this.input.properties ?? {}).map(([key, property]) => {
return [
@@ -99,7 +101,7 @@ export class ObjectConverterNode extends BaseOpenApiV3_1ConverterNode<
return undefined;
}
- return convertToObjectProperties(this.properties);
+ return convertToObjectProperties(this.properties, this.requiredProperties);
}
convertExtraProperties(): FernRegistry.api.latest.TypeReference | undefined {
diff --git a/packages/parsers/src/openapi/3.1/schemas/SchemaConverter.node.ts b/packages/parsers/src/openapi/3.1/schemas/SchemaConverter.node.ts
index e70afb68bc..12d29269cb 100644
--- a/packages/parsers/src/openapi/3.1/schemas/SchemaConverter.node.ts
+++ b/packages/parsers/src/openapi/3.1/schemas/SchemaConverter.node.ts
@@ -9,6 +9,7 @@ import { AvailabilityConverterNode } from "../extensions/AvailabilityConverter.n
import { isArraySchema } from "../guards/isArraySchema";
import { isBooleanSchema } from "../guards/isBooleanSchema";
import { isIntegerSchema } from "../guards/isIntegerSchema";
+import { isMixedSchema } from "../guards/isMixedSchema";
import { isNonArraySchema } from "../guards/isNonArraySchema";
import { isNullSchema } from "../guards/isNullSchema";
import { isNumberSchema } from "../guards/isNumberSchema";
@@ -16,6 +17,8 @@ import { isObjectSchema } from "../guards/isObjectSchema";
import { isReferenceObject } from "../guards/isReferenceObject";
import { isStringSchema } from "../guards/isStringSchema";
import { ArrayConverterNode } from "./ArrayConverter.node";
+import { ConstConverterNode } from "./ConstConverter.node";
+import { MixedSchemaConverterNode } from "./MixedSchemaConverter.node";
import { ObjectConverterNode } from "./ObjectConverter.node";
import { OneOfConverterNode } from "./OneOfConverter.node";
import { ReferenceConverterNode } from "./ReferenceConverter.node";
@@ -70,7 +73,21 @@ export class SchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
// If the object is not a reference object, then it is a schema object, gather all appropriate variables
this.name = this.input.title;
- if (isNonArraySchema(this.input) && this.input.oneOf != null) {
+ if (this.input.const != null) {
+ this.typeShapeNode = new ConstConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ } else if (isMixedSchema(this.input)) {
+ this.typeShapeNode = new MixedSchemaConverterNode({
+ input: this.input,
+ context: this.context,
+ accessPath: this.accessPath,
+ pathId: this.pathId,
+ });
+ } else if (isNonArraySchema(this.input) && this.input.oneOf != null) {
this.typeShapeNode = new OneOfConverterNode({
input: this.input,
context: this.context,
@@ -131,7 +148,7 @@ export class SchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
case "integer":
if (isIntegerSchema(this.input)) {
this.typeShapeNode = new IntegerConverterNode({
- input: this.input as IntegerConverterNode.Input,
+ input: this.input,
context: this.context,
accessPath: this.accessPath,
pathId: this.pathId,
@@ -141,7 +158,7 @@ export class SchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
case "number":
if (isNumberSchema(this.input)) {
this.typeShapeNode = new NumberConverterNode({
- input: this.input as NumberConverterNode.Input,
+ input: this.input,
context: this.context,
accessPath: this.accessPath,
pathId: this.pathId,
@@ -151,7 +168,7 @@ export class SchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
case "string":
if (isStringSchema(this.input)) {
this.typeShapeNode = new StringConverterNode({
- input: this.input as StringConverterNode.Input,
+ input: this.input,
context: this.context,
accessPath: this.accessPath,
pathId: this.pathId,
@@ -161,7 +178,7 @@ export class SchemaConverterNode extends BaseOpenApiV3_1ConverterNode<
case "null":
if (isNullSchema(this.input)) {
this.typeShapeNode = new NullConverterNode({
- input: this.input as NullConverterNode.Input,
+ input: this.input,
context: this.context,
accessPath: this.accessPath,
pathId: this.pathId,
diff --git a/packages/parsers/src/openapi/3.1/schemas/__test__/ConstConverterNode.test.ts b/packages/parsers/src/openapi/3.1/schemas/__test__/ConstConverterNode.test.ts
new file mode 100644
index 0000000000..20c0f73e0b
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/schemas/__test__/ConstConverterNode.test.ts
@@ -0,0 +1,106 @@
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { ConstConverterNode } from "../ConstConverter.node";
+
+describe("ConstConverterNode", () => {
+ const context = createMockContext();
+
+ describe("parse()", () => {
+ it("handles string const", () => {
+ const node = new ConstConverterNode({
+ input: {
+ const: "test",
+ description: "test description",
+ },
+ context,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toEqual({
+ type: "enum",
+ default: "test",
+ values: [
+ {
+ value: "test",
+ description: "test description",
+ availability: undefined,
+ },
+ ],
+ });
+ });
+
+ it("handles number const", () => {
+ const node = new ConstConverterNode({
+ input: {
+ const: 123,
+ },
+ context,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toEqual({
+ type: "enum",
+ default: "123",
+ values: [
+ {
+ value: "123",
+ description: undefined,
+ availability: undefined,
+ },
+ ],
+ });
+ });
+
+ it("handles boolean const", () => {
+ const node = new ConstConverterNode({
+ input: {
+ const: true,
+ },
+ context,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toEqual({
+ type: "enum",
+ default: "true",
+ values: [
+ {
+ value: "true",
+ description: undefined,
+ availability: undefined,
+ },
+ ],
+ });
+ });
+
+ it("handles unsupported const type", () => {
+ const node = new ConstConverterNode({
+ input: {
+ const: { foo: "bar" },
+ },
+ context,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toBeUndefined();
+ expect(context.errors.warning).toHaveBeenCalledWith({
+ message: expect.stringContaining("Unsupported const type"),
+ path: ["test"],
+ });
+ });
+
+ it("handles undefined const", () => {
+ const node = new ConstConverterNode({
+ input: {},
+ context,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.convert()).toBeUndefined();
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/3.1/schemas/__test__/MixedSchemaConverter.node.test.ts b/packages/parsers/src/openapi/3.1/schemas/__test__/MixedSchemaConverter.node.test.ts
new file mode 100644
index 0000000000..e936564d41
--- /dev/null
+++ b/packages/parsers/src/openapi/3.1/schemas/__test__/MixedSchemaConverter.node.test.ts
@@ -0,0 +1,88 @@
+import { createMockContext } from "../../../../__test__/createMockContext.util";
+import { FernRegistry } from "../../../../client/generated";
+import { MixedSchemaConverterNode } from "../MixedSchemaConverter.node";
+
+describe("MixedSchemaConverterNode", () => {
+ const mockContext = createMockContext();
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ describe("constructor", () => {
+ it("should handle mixed schema with null type", () => {
+ const input: MixedSchemaConverterNode.Input = [{ type: "null" }, { type: "string" }];
+
+ const node = new MixedSchemaConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.nullable).toBe(true);
+ expect(node.typeNodes?.length).toBe(1);
+ });
+
+ it("should handle mixed schema with multiple non-null types", () => {
+ const input: MixedSchemaConverterNode.Input = [{ type: "string" }, { type: "number" }];
+
+ const node = new MixedSchemaConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ expect(node.nullable).toBeUndefined();
+ expect(node.typeNodes?.length).toBe(2);
+ });
+ });
+
+ describe("convert", () => {
+ it("should convert to undiscriminatedUnion when not nullable", () => {
+ const input: MixedSchemaConverterNode.Input = [{ type: "string" }, { type: "number" }];
+
+ const node = new MixedSchemaConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const result = node.convert();
+ expect(result?.type).toBe("undiscriminatedUnion");
+ expect((result as FernRegistry.api.latest.TypeShape.UndiscriminatedUnion)?.variants?.length).toBe(2);
+ });
+
+ it("should convert to optional alias when nullable", () => {
+ const input: MixedSchemaConverterNode.Input = [{ type: "null" }, { type: "string" }];
+
+ const node = new MixedSchemaConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ const result = node.convert();
+ expect(result?.type).toBe("alias");
+ expect((result as FernRegistry.api.latest.TypeShape.Alias)?.value?.type).toBe("optional");
+ });
+
+ it("should return undefined when typeNodes is null", () => {
+ const input: MixedSchemaConverterNode.Input = [];
+
+ const node = new MixedSchemaConverterNode({
+ input,
+ context: mockContext,
+ accessPath: [],
+ pathId: "test",
+ });
+
+ node.typeNodes = undefined;
+ const result = node.convert();
+ expect(result).toBeUndefined();
+ });
+ });
+});
diff --git a/packages/parsers/src/openapi/types/extension.types.ts b/packages/parsers/src/openapi/types/extension.types.ts
deleted file mode 100644
index 4e3b89888a..0000000000
--- a/packages/parsers/src/openapi/types/extension.types.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const basePathExtensionKey: string = "x-fern-base-path";
diff --git a/packages/parsers/src/openapi/utils/3.1/convertToObjectProperties.ts b/packages/parsers/src/openapi/utils/3.1/convertToObjectProperties.ts
index d1b09723c6..7e45e5983e 100644
--- a/packages/parsers/src/openapi/utils/3.1/convertToObjectProperties.ts
+++ b/packages/parsers/src/openapi/utils/3.1/convertToObjectProperties.ts
@@ -4,16 +4,30 @@ import { ParameterBaseObjectConverterNode, SchemaConverterNode } from "../../3.1
export function convertToObjectProperties(
properties: Record | undefined,
+ requiredProperties: string[] | undefined,
): FernRegistry.api.latest.ObjectProperty[] | undefined {
if (properties == null) {
return undefined;
}
+
return Object.entries(properties)
.map(([key, node]) => {
- const valueShape = node.convert();
+ let valueShape = node.convert();
if (valueShape == null) {
return undefined;
}
+
+ if (requiredProperties != null && !requiredProperties.includes(key)) {
+ valueShape = {
+ type: "alias",
+ value: {
+ type: "optional",
+ shape: valueShape,
+ default: valueShape.type === "enum" ? valueShape.default : undefined,
+ },
+ };
+ }
+
return {
key: FernRegistry.PropertyKey(key),
valueShape,
diff --git a/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts b/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts
index 495adf3345..ad513af47d 100644
--- a/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts
+++ b/packages/parsers/src/openapi/utils/3.1/resolveResponseReference.ts
@@ -7,7 +7,14 @@ export function resolveResponseReference(
document: OpenAPIV3_1.Document,
): OpenAPIV3_1.ResponseObject | undefined {
if (isReferenceObject(referenceObject)) {
- return resolveReference(referenceObject, document, undefined);
+ const resolved = resolveReference(referenceObject, document, undefined);
+ if (resolved == null) {
+ return undefined;
+ }
+ return {
+ ...resolved,
+ ...referenceObject,
+ } as OpenAPIV3_1.ResponseObject;
}
return referenceObject;
diff --git a/packages/parsers/src/openapi/utils/3.1/resolveSecurityScheme.ts b/packages/parsers/src/openapi/utils/3.1/resolveSecurityScheme.ts
new file mode 100644
index 0000000000..7c8918821f
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/3.1/resolveSecurityScheme.ts
@@ -0,0 +1,18 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { isReferenceObject } from "../../3.1/guards/isReferenceObject";
+import { resolveReference } from "./resolveReference";
+
+export function resolveSecurityScheme(
+ securitySchemeId: string,
+ document: OpenAPIV3_1.Document,
+): OpenAPIV3_1.SecuritySchemeObject | undefined {
+ const securityScheme = document.components?.securitySchemes?.[securitySchemeId];
+ if (securityScheme == null) {
+ return undefined;
+ }
+ if (isReferenceObject(securityScheme)) {
+ return resolveReference(securityScheme, document, undefined);
+ }
+
+ return securityScheme;
+}
diff --git a/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts b/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts
new file mode 100644
index 0000000000..d3a203a30e
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/3.1/resolveWebhookReference.ts
@@ -0,0 +1,21 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { isReferenceObject } from "../../3.1/guards/isReferenceObject";
+import { resolveReference } from "./resolveReference";
+
+export function resolveWebhookReference(
+ operationItem: OpenAPIV3_1.PathItemObject | OpenAPIV3_1.ReferenceObject,
+ document: OpenAPIV3_1.Document,
+): OpenAPIV3_1.PathItemObject | undefined {
+ if (isReferenceObject(operationItem)) {
+ const resolved = resolveReference(operationItem, document, undefined);
+ if (resolved == null) {
+ return undefined;
+ }
+ return {
+ ...resolved,
+ ...operationItem,
+ } as OpenAPIV3_1.OperationObject;
+ }
+
+ return operationItem;
+}
diff --git a/packages/parsers/src/openapi/utils/__test__/3.1/convertToObjectProperties.test.ts b/packages/parsers/src/openapi/utils/__test__/3.1/convertToObjectProperties.test.ts
index d334056c9a..cc87289983 100644
--- a/packages/parsers/src/openapi/utils/__test__/3.1/convertToObjectProperties.test.ts
+++ b/packages/parsers/src/openapi/utils/__test__/3.1/convertToObjectProperties.test.ts
@@ -8,7 +8,7 @@ describe("convertToObjectProperties", () => {
const mockContext = createMockContext();
it("should return undefined when properties is undefined", () => {
- expect(convertToObjectProperties(undefined)).toBeUndefined();
+ expect(convertToObjectProperties(undefined, undefined)).toBeUndefined();
});
it("should convert properties to object properties", () => {
@@ -58,7 +58,7 @@ describe("convertToObjectProperties", () => {
}),
};
- const result = convertToObjectProperties(properties);
+ const result = convertToObjectProperties(properties, undefined);
expect(result).toEqual([
{
@@ -107,7 +107,7 @@ describe("convertToObjectProperties", () => {
} as unknown as SchemaConverterNode,
};
- const result = convertToObjectProperties(properties);
+ const result = convertToObjectProperties(properties, undefined);
expect(result).toEqual([
{
diff --git a/packages/parsers/src/openapi/utils/__test__/3.1/resolveSecurityScheme.test.ts b/packages/parsers/src/openapi/utils/__test__/3.1/resolveSecurityScheme.test.ts
new file mode 100644
index 0000000000..0dea103633
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/__test__/3.1/resolveSecurityScheme.test.ts
@@ -0,0 +1,65 @@
+import { OpenAPIV3_1 } from "openapi-types";
+import { resolveSecurityScheme } from "../../3.1/resolveSecurityScheme";
+
+describe("resolveSecurityScheme", () => {
+ it("returns undefined when security scheme is not found", () => {
+ const document: OpenAPIV3_1.Document = {
+ openapi: "3.1.0",
+ info: { title: "Test API", version: "1.0.0" },
+ paths: {},
+ };
+ expect(resolveSecurityScheme("nonexistent", document)).toBeUndefined();
+ });
+
+ it("returns the security scheme directly when not a reference", () => {
+ const securityScheme: OpenAPIV3_1.SecuritySchemeObject = {
+ type: "http",
+ scheme: "basic",
+ };
+ const document: OpenAPIV3_1.Document = {
+ openapi: "3.1.0",
+ info: { title: "Test API", version: "1.0.0" },
+ paths: {},
+ components: {
+ securitySchemes: {
+ basicAuth: securityScheme,
+ },
+ },
+ };
+ expect(resolveSecurityScheme("basicAuth", document)).toBe(securityScheme);
+ });
+
+ it("resolves referenced security scheme", () => {
+ const referencedScheme: OpenAPIV3_1.SecuritySchemeObject = {
+ type: "apiKey",
+ in: "header",
+ name: "X-API-Key",
+ };
+ const document: OpenAPIV3_1.Document = {
+ openapi: "3.1.0",
+ info: { title: "Test API", version: "1.0.0" },
+ paths: {},
+ components: {
+ securitySchemes: {
+ apiKey: { $ref: "#/components/securitySchemes/referencedApiKey" },
+ referencedApiKey: referencedScheme,
+ },
+ },
+ };
+ expect(resolveSecurityScheme("apiKey", document)).toEqual(referencedScheme);
+ });
+
+ it("returns undefined when referenced security scheme doesn't exist", () => {
+ const document: OpenAPIV3_1.Document = {
+ openapi: "3.1.0",
+ info: { title: "Test API", version: "1.0.0" },
+ paths: {},
+ components: {
+ securitySchemes: {
+ apiKey: { $ref: "#/components/securitySchemes/nonexistent" },
+ },
+ },
+ };
+ expect(resolveSecurityScheme("apiKey", document)).toBeUndefined();
+ });
+});
diff --git a/packages/parsers/src/openapi/utils/__test__/getEndpointId.test.ts b/packages/parsers/src/openapi/utils/__test__/getEndpointId.test.ts
new file mode 100644
index 0000000000..08725c76dd
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/__test__/getEndpointId.test.ts
@@ -0,0 +1,27 @@
+import { getEndpointId } from "../getEndpointId";
+
+describe("getEndpointId", () => {
+ it("converts method and path to kebab case", () => {
+ expect(getEndpointId("GET", "/users")).toBe("get-users");
+ });
+
+ it("handles multiple path segments", () => {
+ expect(getEndpointId("POST", "/users/orders/items")).toBe("post-users-orders-items");
+ });
+
+ it("handles uppercase methods", () => {
+ expect(getEndpointId("DELETE", "/users")).toBe("delete-users");
+ });
+
+ it("handles path parameters", () => {
+ expect(getEndpointId("PUT", "/users/{userId}")).toBe("put-users-user-id");
+ });
+
+ it("handles empty path", () => {
+ expect(getEndpointId("GET", "")).toBe("get");
+ });
+
+ it("handles path with trailing slash", () => {
+ expect(getEndpointId("POST", "/users/")).toBe("post-users");
+ });
+});
diff --git a/packages/parsers/src/openapi/utils/__test__/isValidJsonPath.test.ts b/packages/parsers/src/openapi/utils/__test__/isValidJsonPath.test.ts
new file mode 100644
index 0000000000..924a116080
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/__test__/isValidJsonPath.test.ts
@@ -0,0 +1,22 @@
+import { isValidJsonPath } from "../isValidJsonPath";
+
+describe("isValidJsonPath", () => {
+ it("should return true for valid JSON paths", () => {
+ expect(isValidJsonPath("$.store.book[0].title")).toBe(true);
+ expect(isValidJsonPath("$.store.book[*].title")).toBe(true);
+ expect(isValidJsonPath("$['store']['book'][0]['title']")).toBe(true);
+ expect(isValidJsonPath("$.store.book[1:3]")).toBe(true);
+ expect(isValidJsonPath("$.store.*")).toBe(true);
+ expect(isValidJsonPath("$")).toBe(true);
+ });
+
+ it("should return false for invalid JSON paths", () => {
+ expect(isValidJsonPath("")).toBe(false);
+ expect(isValidJsonPath("invalid")).toBe(false);
+ expect(isValidJsonPath("$.store.#invalid")).toBe(false);
+ expect(isValidJsonPath("$.store[abc]")).toBe(false);
+ expect(isValidJsonPath("$.store[]")).toBe(false);
+ expect(isValidJsonPath("$.store.book[0]]")).toBe(false);
+ expect(isValidJsonPath("$..store")).toBe(false);
+ });
+});
diff --git a/packages/parsers/src/openapi/utils/getEndpointId.ts b/packages/parsers/src/openapi/utils/getEndpointId.ts
new file mode 100644
index 0000000000..724c8b1061
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/getEndpointId.ts
@@ -0,0 +1,5 @@
+import { kebabCase } from "es-toolkit";
+
+export function getEndpointId(method: string, path: string): string {
+ return kebabCase(`${method}-${path.replace(/\//g, "-")}`);
+}
diff --git a/packages/parsers/src/openapi/utils/isValidJsonPath.ts b/packages/parsers/src/openapi/utils/isValidJsonPath.ts
new file mode 100644
index 0000000000..d0a80b7262
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/isValidJsonPath.ts
@@ -0,0 +1,7 @@
+export function isValidJsonPath(path: string): boolean {
+ if (path.length === 0) {
+ return false;
+ }
+ const jsonPathRegex = /^\$?(\.[\w*]+|\[['"][\w*]+['"]?\]|\[['"]?[\d*]+['"]?\]|\[[\d:]+\])*$/;
+ return jsonPathRegex.test(path);
+}
diff --git a/packages/parsers/src/openapi/utils/statusCodes.ts b/packages/parsers/src/openapi/utils/statusCodes.ts
new file mode 100644
index 0000000000..49c41c4f9b
--- /dev/null
+++ b/packages/parsers/src/openapi/utils/statusCodes.ts
@@ -0,0 +1,65 @@
+export const STATUS_CODE_MESSAGES: Record = {
+ 100: "Continue",
+ 101: "Switching Protocols",
+ 102: "Processing",
+ 103: "Early Hints",
+ 200: "OK",
+ 201: "Created",
+ 202: "Accepted",
+ 203: "Non-Authoritative Information",
+ 204: "No Content",
+ 205: "Reset Content",
+ 206: "Partial Content",
+ 207: "Multi-Status",
+ 208: "Already Reported",
+ 226: "IM Used",
+ 300: "Multiple Choices",
+ 301: "Moved Permanently",
+ 302: "Found",
+ 303: "See Other",
+ 304: "Not Modified",
+ 305: "Use Proxy",
+ 306: "Switch Proxy",
+ 307: "Temporary Redirect",
+ 308: "Permanent Redirect",
+ 400: "Bad Request",
+ 401: "Unauthorized",
+ 402: "Payment Required",
+ 403: "Forbidden",
+ 404: "Not Found",
+ 405: "Method Not Allowed",
+ 406: "Not Acceptable",
+ 407: "Proxy Authentication Required",
+ 408: "Request Timeout",
+ 409: "Conflict",
+ 410: "Gone",
+ 411: "Length Required",
+ 412: "Precondition Failed",
+ 413: "Payload Too Large",
+ 414: "URI Too Long",
+ 415: "Unsupported Media Type",
+ 416: "Range Not Satisfiable",
+ 417: "Expectation Failed",
+ 418: "I'm a teapot",
+ 421: "Misdirected Request",
+ 422: "Unprocessable Entity",
+ 423: "Locked",
+ 424: "Failed Dependency",
+ 425: "Too Early",
+ 426: "Upgrade Required",
+ 428: "Precondition Required",
+ 429: "Too Many Requests",
+ 431: "Request Header Fields Too Large",
+ 451: "Unavailable For Legal Reasons",
+ 500: "Internal Server Error",
+ 501: "Not Implemented",
+ 502: "Bad Gateway",
+ 503: "Service Unavailable",
+ 504: "Gateway Timeout",
+ 505: "HTTP Version Not Supported",
+ 506: "Variant Also Negotiates",
+ 507: "Insufficient Storage",
+ 508: "Loop Detected",
+ 510: "Not Extended",
+ 511: "Network Authentication Required",
+};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 94fb59bbc3..a021387c5e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -982,6 +982,9 @@ importers:
'@fern-api/ui-core-utils':
specifier: workspace:*
version: link:../commons/core-utils
+ es-toolkit:
+ specifier: ^1.24.0
+ version: 1.27.0
openapi-types:
specifier: ^12.1.3
version: 12.1.3