Skip to content

Commit 039c601

Browse files
authored
fix: ensure that /providers list and shell endpoints are correctly typed in sdk and openapi schema (#21543)
1 parent cd87d4f commit 039c601

File tree

4 files changed

+21
-271
lines changed

4 files changed

+21
-271
lines changed

packages/opencode/src/server/routes/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const ProviderRoutes = lazy(() =>
2828
"application/json": {
2929
schema: resolver(
3030
z.object({
31-
all: ModelsDev.Provider.array(),
31+
all: Provider.Info.array(),
3232
default: z.record(z.string(), z.string()),
3333
connected: z.array(z.string()),
3434
}),

packages/opencode/src/server/routes/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ export const SessionRoutes = lazy(() =>
906906
description: "Created message",
907907
content: {
908908
"application/json": {
909-
schema: resolver(MessageV2.Assistant),
909+
schema: resolver(MessageV2.WithParts),
910910
},
911911
},
912912
},

packages/sdk/js/src/v2/gen/types.gen.ts

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3936,7 +3936,10 @@ export type SessionShellResponses = {
39363936
/**
39373937
* Created message
39383938
*/
3939-
200: AssistantMessage
3939+
200: {
3940+
info: Message
3941+
parts: Array<Part>
3942+
}
39403943
}
39413944

39423945
export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]
@@ -4212,68 +4215,7 @@ export type ProviderListResponses = {
42124215
* List of providers
42134216
*/
42144217
200: {
4215-
all: Array<{
4216-
api?: string
4217-
name: string
4218-
env: Array<string>
4219-
id: string
4220-
npm?: string
4221-
models: {
4222-
[key: string]: {
4223-
id: string
4224-
name: string
4225-
family?: string
4226-
release_date: string
4227-
attachment: boolean
4228-
reasoning: boolean
4229-
temperature: boolean
4230-
tool_call: boolean
4231-
interleaved?:
4232-
| true
4233-
| {
4234-
field: "reasoning_content" | "reasoning_details"
4235-
}
4236-
cost?: {
4237-
input: number
4238-
output: number
4239-
cache_read?: number
4240-
cache_write?: number
4241-
context_over_200k?: {
4242-
input: number
4243-
output: number
4244-
cache_read?: number
4245-
cache_write?: number
4246-
}
4247-
}
4248-
limit: {
4249-
context: number
4250-
input?: number
4251-
output: number
4252-
}
4253-
modalities?: {
4254-
input: Array<"text" | "audio" | "image" | "video" | "pdf">
4255-
output: Array<"text" | "audio" | "image" | "video" | "pdf">
4256-
}
4257-
experimental?: boolean
4258-
status?: "alpha" | "beta" | "deprecated"
4259-
options: {
4260-
[key: string]: unknown
4261-
}
4262-
headers?: {
4263-
[key: string]: string
4264-
}
4265-
provider?: {
4266-
npm?: string
4267-
api?: string
4268-
}
4269-
variants?: {
4270-
[key: string]: {
4271-
[key: string]: unknown
4272-
}
4273-
}
4274-
}
4275-
}
4276-
}>
4218+
all: Array<Provider>
42774219
default: {
42784220
[key: string]: string
42794221
}

packages/sdk/openapi.json

Lines changed: 14 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -4098,7 +4098,19 @@
40984098
"content": {
40994099
"application/json": {
41004100
"schema": {
4101-
"$ref": "#/components/schemas/AssistantMessage"
4101+
"type": "object",
4102+
"properties": {
4103+
"info": {
4104+
"$ref": "#/components/schemas/Message"
4105+
},
4106+
"parts": {
4107+
"type": "array",
4108+
"items": {
4109+
"$ref": "#/components/schemas/Part"
4110+
}
4111+
}
4112+
},
4113+
"required": ["info", "parts"]
41024114
}
41034115
}
41044116
}
@@ -4790,211 +4802,7 @@
47904802
"all": {
47914803
"type": "array",
47924804
"items": {
4793-
"type": "object",
4794-
"properties": {
4795-
"api": {
4796-
"type": "string"
4797-
},
4798-
"name": {
4799-
"type": "string"
4800-
},
4801-
"env": {
4802-
"type": "array",
4803-
"items": {
4804-
"type": "string"
4805-
}
4806-
},
4807-
"id": {
4808-
"type": "string"
4809-
},
4810-
"npm": {
4811-
"type": "string"
4812-
},
4813-
"models": {
4814-
"type": "object",
4815-
"propertyNames": {
4816-
"type": "string"
4817-
},
4818-
"additionalProperties": {
4819-
"type": "object",
4820-
"properties": {
4821-
"id": {
4822-
"type": "string"
4823-
},
4824-
"name": {
4825-
"type": "string"
4826-
},
4827-
"family": {
4828-
"type": "string"
4829-
},
4830-
"release_date": {
4831-
"type": "string"
4832-
},
4833-
"attachment": {
4834-
"type": "boolean"
4835-
},
4836-
"reasoning": {
4837-
"type": "boolean"
4838-
},
4839-
"temperature": {
4840-
"type": "boolean"
4841-
},
4842-
"tool_call": {
4843-
"type": "boolean"
4844-
},
4845-
"interleaved": {
4846-
"anyOf": [
4847-
{
4848-
"type": "boolean",
4849-
"const": true
4850-
},
4851-
{
4852-
"type": "object",
4853-
"properties": {
4854-
"field": {
4855-
"type": "string",
4856-
"enum": ["reasoning_content", "reasoning_details"]
4857-
}
4858-
},
4859-
"required": ["field"],
4860-
"additionalProperties": false
4861-
}
4862-
]
4863-
},
4864-
"cost": {
4865-
"type": "object",
4866-
"properties": {
4867-
"input": {
4868-
"type": "number"
4869-
},
4870-
"output": {
4871-
"type": "number"
4872-
},
4873-
"cache_read": {
4874-
"type": "number"
4875-
},
4876-
"cache_write": {
4877-
"type": "number"
4878-
},
4879-
"context_over_200k": {
4880-
"type": "object",
4881-
"properties": {
4882-
"input": {
4883-
"type": "number"
4884-
},
4885-
"output": {
4886-
"type": "number"
4887-
},
4888-
"cache_read": {
4889-
"type": "number"
4890-
},
4891-
"cache_write": {
4892-
"type": "number"
4893-
}
4894-
},
4895-
"required": ["input", "output"]
4896-
}
4897-
},
4898-
"required": ["input", "output"]
4899-
},
4900-
"limit": {
4901-
"type": "object",
4902-
"properties": {
4903-
"context": {
4904-
"type": "number"
4905-
},
4906-
"input": {
4907-
"type": "number"
4908-
},
4909-
"output": {
4910-
"type": "number"
4911-
}
4912-
},
4913-
"required": ["context", "output"]
4914-
},
4915-
"modalities": {
4916-
"type": "object",
4917-
"properties": {
4918-
"input": {
4919-
"type": "array",
4920-
"items": {
4921-
"type": "string",
4922-
"enum": ["text", "audio", "image", "video", "pdf"]
4923-
}
4924-
},
4925-
"output": {
4926-
"type": "array",
4927-
"items": {
4928-
"type": "string",
4929-
"enum": ["text", "audio", "image", "video", "pdf"]
4930-
}
4931-
}
4932-
},
4933-
"required": ["input", "output"]
4934-
},
4935-
"experimental": {
4936-
"type": "boolean"
4937-
},
4938-
"status": {
4939-
"type": "string",
4940-
"enum": ["alpha", "beta", "deprecated"]
4941-
},
4942-
"options": {
4943-
"type": "object",
4944-
"propertyNames": {
4945-
"type": "string"
4946-
},
4947-
"additionalProperties": {}
4948-
},
4949-
"headers": {
4950-
"type": "object",
4951-
"propertyNames": {
4952-
"type": "string"
4953-
},
4954-
"additionalProperties": {
4955-
"type": "string"
4956-
}
4957-
},
4958-
"provider": {
4959-
"type": "object",
4960-
"properties": {
4961-
"npm": {
4962-
"type": "string"
4963-
},
4964-
"api": {
4965-
"type": "string"
4966-
}
4967-
}
4968-
},
4969-
"variants": {
4970-
"type": "object",
4971-
"propertyNames": {
4972-
"type": "string"
4973-
},
4974-
"additionalProperties": {
4975-
"type": "object",
4976-
"propertyNames": {
4977-
"type": "string"
4978-
},
4979-
"additionalProperties": {}
4980-
}
4981-
}
4982-
},
4983-
"required": [
4984-
"id",
4985-
"name",
4986-
"release_date",
4987-
"attachment",
4988-
"reasoning",
4989-
"temperature",
4990-
"tool_call",
4991-
"limit",
4992-
"options"
4993-
]
4994-
}
4995-
}
4996-
},
4997-
"required": ["name", "env", "id", "models"]
4805+
"$ref": "#/components/schemas/Provider"
49984806
}
49994807
},
50004808
"default": {

0 commit comments

Comments
 (0)