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

Deny unknown fields #351

Merged
merged 2 commits into from
Dec 13, 2024
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
1 change: 1 addition & 0 deletions buildpacks/ruby/src/layers/bundle_download_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ try_migrate_deserializer_chain!(
);

#[derive(Deserialize, Serialize, Debug, Clone, CacheDiff)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV1 {
#[cache_diff(rename = "Bundler version")]
pub(crate) version: ResolvedBundlerVersion,
Expand Down
3 changes: 3 additions & 0 deletions buildpacks/ruby/src/layers/bundle_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ try_migrate_deserializer_chain!(
);

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV1 {
pub(crate) stack: String,
pub(crate) ruby_version: ResolvedRubyVersion,
Expand All @@ -133,6 +134,7 @@ pub(crate) struct MetadataV1 {
}

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV2 {
pub(crate) distro_name: String,
pub(crate) distro_version: String,
Expand Down Expand Up @@ -315,6 +317,7 @@ fn display_name(cmd: &mut Command, env: &Env) -> String {
}

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, Default)]
#[serde(deny_unknown_fields)]
schneems marked this conversation as resolved.
Show resolved Hide resolved
pub(crate) struct BundleDigest {
env: String,
gemfile: String,
Expand Down
1 change: 1 addition & 0 deletions buildpacks/ruby/src/layers/metrics_agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const DOWNLOAD_URL: &str =
const DOWNLOAD_SHA: &str = "f9bf9f33c949e15ffed77046ca38f8dae9307b6a0181c6af29a25dec46eb2dac";

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub(crate) struct Metadata {
download_url: String,
}
Expand Down
2 changes: 2 additions & 0 deletions buildpacks/ruby/src/layers/ruby_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ fn install_ruby(metadata: &Metadata, layer_path: &Path) -> Result<(), RubyBuildp
}

#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV1 {
pub(crate) stack: String,
pub(crate) version: ResolvedRubyVersion,
}

#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
#[serde(deny_unknown_fields)]
pub(crate) struct MetadataV2 {
pub(crate) distro_name: String,
pub(crate) distro_version: String,
Expand Down
1 change: 1 addition & 0 deletions commons/src/cache/app_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ pub enum PathState {
/// allows for emails, that might live a long time, to reference a specific SHA of an
/// asset.
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)]
#[serde(deny_unknown_fields)]
pub(crate) struct Metadata {
pub(crate) app_dir_path: PathBuf,
}
Expand Down
2 changes: 2 additions & 0 deletions commons/src/metadata_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const PLATFORM_ENV_VAR: &str = "user configured environment variables";
/// use commons::metadata_digest::MetadataDigest;
///
/// #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
/// #[serde(deny_unknown_fields)]
/// pub(crate) struct BundleInstallLayerMetadata {
/// ruby_version: String,
/// force_bundle_install_key: String,
Expand Down Expand Up @@ -82,6 +83,7 @@ const PLATFORM_ENV_VAR: &str = "user configured environment variables";
/// # }
/// #
/// # #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
/// # #[serde(deny_unknown_fields)]
/// # struct FakeLayerMetadata {
/// # digest: MetadataDigest,
/// # }
Expand Down