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
Implement image spec #25
Conversation
Codecov Report
@@ Coverage Diff @@
## main #25 +/- ##
==========================================
- Coverage 20.31% 19.46% -0.85%
==========================================
Files 7 11 +4
Lines 699 863 +164
Branches 371 463 +92
==========================================
+ Hits 142 168 +26
- Misses 274 354 +80
- Partials 283 341 +58 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, I just have a few nits.
src/image/config.rs
Outdated
use serde::ser::SerializeMap; | ||
use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, unfortunately merge_imports
is still an unstable feature of rustfmt:
use serde::ser::SerializeMap; | |
use serde::{Deserialize, Deserializer, Serialize, Serializer}; | |
use serde::{Deserialize, Deserializer, Serialize, Serializer, ser::SerializeMap}; |
); | ||
|
||
impl ImageConfiguration { | ||
pub fn load<P: AsRef<Path>>(path: P) -> Result<ImageConfiguration> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a doc comment.
/// a filesystem diff. It is set to true if this history item | ||
/// doesn't correspond to an actual layer in the rootfs section | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
empty_layer: Option<bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty_layer: Option<bool>, | |
#[cfg_attr(feature = "builder", getset(get_copy = "pub"))] | |
empty_layer: Option<bool>, |
src/image/config.rs
Outdated
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), | ||
builder(default, pattern = "owned", setter(into, strip_option)), | ||
getset(get = "pub") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getset(get = "pub") |
src/image/config.rs
Outdated
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] | ||
#[cfg_attr( | ||
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derive(derive_builder::Builder, getset::Getters), | |
derive(derive_builder::Builder, getset::CopyGetters, getset::Getters), |
src/image/index.rs
Outdated
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), | ||
builder(default, pattern = "owned", setter(into, strip_option)), | ||
getset(get = "pub") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this
getset(get = "pub") |
src/image/manifest.rs
Outdated
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), | ||
builder(pattern = "owned", setter(into, strip_option)), | ||
getset(get = "pub") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getset(get = "pub") |
src/image/manifest.rs
Outdated
#[serde(rename_all = "camelCase")] | ||
#[cfg_attr( | ||
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derive(derive_builder::Builder, getset::Getters), | |
derive(derive_builder::Builder, getset::CopyGetters, getset::Getters), |
src/image/index.rs
Outdated
#[serde(rename_all = "camelCase")] | ||
#[cfg_attr( | ||
feature = "builder", | ||
derive(derive_builder::Builder, getset::Getters), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derive(derive_builder::Builder, getset::Getters), | |
derive(derive_builder::Builder, getset::CopyGetters, getset::Getters), |
test_files/image/config.json
Outdated
@@ -0,0 +1,52 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about putting those files into the official test
directory, like: test/data
?
@saschagrunert PTAL |
Thanks! Rustfmt allows 100chars but having 80 does not hurt. I’m using vim with YouCompleteMe and the rust analyzer. This works pretty well from my experience, unfortunately I don’t know how it behaves with intellisense. |
Solves #10. Another PR with additional tests will follow.