-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
Summary
I'm not sure if I'd call this a bug per-se, but the JSON Schema representation of the error codes does not include the error code name. The error codes are defined in Rust as follows:
pub enum ErrorCode {
// Standard errors
/// Invalid JSON was received by the server.
/// An error occurred on the server while parsing the JSON text.
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Parse error")]
ParseError, // -32700
/// The JSON sent is not a valid Request object.
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Invalid request")]
InvalidRequest, // -32600
/// The method does not exist or is not available.
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Method not found")]
MethodNotFound, // -32601
/// Invalid method parameter(s).
#[schemars(transform = error_code_transform)]
#[strum(to_string = "Invalid params")]
InvalidParams, // -32602
..
}But in the JSON Schema doc they are surfaced like this:
"ErrorCode": {
"anyOf": [
{
"const": -32700,
"description": "**Parse error**: Invalid JSON was received by the server.\nAn error occurred on the server while parsing the JSON text.",
"format": "int32",
"type": "integer"
},
{
"const": -32600,
"description": "**Invalid request**: The JSON sent is not a valid Request object.",
"format": "int32",
"type": "integer"
},
{
"const": -32601,
"description": "**Method not found**: The method does not exist or is not available.",
"format": "int32",
"type": "integer"
},
{
"const": -32602,
"description": "**Invalid params**: Invalid method parameter(s).",
"format": "int32",
"type": "integer"
},
{
"const": -32603,
"description": "**Internal error**: Internal JSON-RPC error.\nReserved for implementation-defined server errors.",
"format": "int32",
"type": "integer"
}
],
}This is now missing the error code name in a location that a general-purpose tool can parse it. From my limited understanding of JSON Schema, I believe this should probably be able populate the "title" field with the enum variant name (See: JSON Schema 2020-12 meta-data & JSON Schema Core 7.7.1.2). It would be great if this could be added. Thanks!
ACP Version
latest
Metadata
Metadata
Assignees
Labels
No labels