Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ pub struct BytesContainer {
#[serde(skip)]
pub codec: Codec,
/// The JSON represantation of the bytes.
#[serde(skip)]
#[serde(flatten)]
pub json_value: Option<serde_json::Value>,
/// The human readable representation of the bytes.
#[serde(skip)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I introduced this for the codecs, but given that it's all json, maybe we should remove it while we are at it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the value here and here when the --json flag isn't passed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but this is mostly to accommodate the raw codec, for which we couldn't make any assumptions when the cli flag was exposed

humanized: "<raw codec>".into(),
e.g., we couldn't assume that it could be represented as json, for all the other cases, humanized is pretty much a json representation if I'm not wrong? So we could drop humanized and simply stringify the json directly. OTOH, maybe it's fine to keep it, and instead we should remove the Raw option from the codec which is what really complicates things here. I'll leave it up to you in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should probably remove the Raw codec. I'm fine doing that outside of this PR though.

pub humanized: String,
/// Context for encoding errors.
#[serde(skip)]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ mod tests {
.expect("Failed waiting for output");

cmd.assert().success();
cmd.assert().stdout(contains("\\\"test\\\": \\\"echo\\\""));
cmd.assert().stdout(contains("\"test\": \"echo\""));

Ok(())
}
Expand Down