Skip to content

Commit 472b1f2

Browse files
committed
build: add schemars and a derive for json schema for TypeKind, EventLogKind
we need it in db-backend for generation of json schema for our types
1 parent 03506e3 commit 472b1f2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

runtime_tracing/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ num-derive = "0.4"
1919
serde = { version = "1.0", features = ["derive"] }
2020
serde_json = "1.0"
2121
serde_repr = "0.1"
22+
schemars = "0.8.2"
2223
capnp = "0.21.1"
2324
zeekstd = "0.5.0"
2425
cbor4ii = { version = "1.0.0", features = ["serde1", "use_std"] }

runtime_tracing/src/types.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::base64;
1010
use num_derive::FromPrimitive;
1111
use serde::{Deserialize, Serialize};
1212
use serde_repr::*;
13+
use schemars::JsonSchema;
1314

1415
// currently, we do assume that we record the whole program
1516
// so, we try to include minimal amount of data,
@@ -396,7 +397,7 @@ pub enum ValueRecord {
396397
}
397398

398399
/// Categories of types recorded in the trace.
399-
#[derive(Debug, Default, Copy, Clone, FromPrimitive, Serialize_repr, Deserialize_repr, PartialEq)]
400+
#[derive(Debug, Default, Copy, Clone, FromPrimitive, Serialize_repr, Deserialize_repr, PartialEq, JsonSchema)]
400401
#[repr(u8)]
401402
pub enum TypeKind {
402403
#[default]
@@ -455,7 +456,7 @@ pub enum TypeKind {
455456
}
456457

457458
/// Kinds of I/O or log events that can appear in a trace.
458-
#[derive(Debug, Default, Copy, Clone, FromPrimitive, Serialize_repr, Deserialize_repr, PartialEq)]
459+
#[derive(Debug, Default, Copy, Clone, FromPrimitive, Serialize_repr, Deserialize_repr, PartialEq, JsonSchema)]
459460
#[repr(u8)]
460461
pub enum EventLogKind {
461462
#[default]

0 commit comments

Comments
 (0)