mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 18:57:17 +03:00
chore(client): sort generated error statuses (#46708)
This commit is contained in:
committed by
GitHub
Unverified
parent
01093db365
commit
74eda7f950
@@ -129,9 +129,12 @@ export function compile<Id extends string, Groups extends HttpApiGroup.Constrain
|
||||
}
|
||||
const payloads = sourcePayloads.map((schema) => normalizeTransport(schema, "payload", endpoint, name)!)
|
||||
const success = normalizeTransport(successSchemas[0], "success", endpoint, name)!
|
||||
const errorSchemas = Array.from(errors).flatMap(([status, schemas]) =>
|
||||
schemas.map((schema) => ({ status, ...normalizeTransport(schema, "error", endpoint, name)! })),
|
||||
)
|
||||
// Sort by status so output does not churn when middleware changes the declaration order.
|
||||
const errorSchemas = Array.from(errors)
|
||||
.toSorted(([a], [b]) => a - b)
|
||||
.flatMap(([status, schemas]) =>
|
||||
schemas.map((schema) => ({ status, ...normalizeTransport(schema, "error", endpoint, name)! })),
|
||||
)
|
||||
const inputs = [
|
||||
...inputFields(params?.schema, "params", name),
|
||||
...inputFields(query?.schema, "query", name),
|
||||
|
||||
Reference in New Issue
Block a user