Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @type field to distinguish error detail types #291

Open
coryan opened this issue Nov 26, 2024 · 0 comments
Open

Use @type field to distinguish error detail types #291

coryan opened this issue Nov 26, 2024 · 0 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@coryan
Copy link
Contributor

coryan commented Nov 26, 2024

The deserialization for error details assumes that each error detail type can be determined from its structure:

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase", untagged)]
#[non_exhaustive]
pub enum StatusDetails {
BadRequest(BadRequest),
DebugInfo(DebugInfo),

The encoding is an Any:

pub details: Vec<StatusDetails>,

That means there should be a @type field with the name of the type. With some custom deserialization we should be able to extract the correct Rust type, without depending on the message structure being different enough.

@coryan coryan added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant