Skip to content

Commit

Permalink
fix: deny unknown fields in PcodecCodecConfigurationV1
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Jan 9, 2025
1 parent 56bb67d commit 58fcf95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions zarrs_metadata/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- **Breaking**: Remove the `v3::array::codec::vlen_v2` module and all associated types

### Fixed
- Deny unknown fields in `PcodecCodecConfigurationV1`

## [0.2.0] - 2024-11-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion zarrs_metadata/src/v2/array/codec/zfpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub const IDENTIFIER: &str = "zfpy";

/// Configuration parameters for the `zfpy` codec (numcodecs).
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, Display)]
// #[serde(deny_unknown_fields)] TODO: zarr-python includes redundant compression_kwargs. Report upstream
// #[serde(deny_unknown_fields)] // FIXME: zarr-python includes redundant compression_kwargs. Report upstream
#[display("{}", serde_json::to_string(self).unwrap_or_default())]
pub struct ZfpyCodecConfigurationNumcodecs {
/// The zfp
Expand Down
1 change: 1 addition & 0 deletions zarrs_metadata/src/v3/array/codec/pcodec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl Default for PcodecCodecConfiguration {
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug, Display)]
#[display("{}", serde_json::to_string(self).unwrap_or_default())]
#[serde(default)] // for compatibility with zarrs < 0.19
#[serde(deny_unknown_fields)]
pub struct PcodecCodecConfigurationV1 {
/// A compression level from 0-12, where 12 takes the longest and compresses the most.
pub level: PcodecCompressionLevel,
Expand Down
1 change: 1 addition & 0 deletions zarrs_metadata/src/v3/array/codec/zfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub enum ZfpCodecConfiguration {
/// # let configuration: ZfpCodecConfigurationV1 = serde_json::from_str(JSON).unwrap();
/// ```
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
// #[serde(deny_unknown_fields)] // NOTE: Not supported with flatten
pub struct ZfpCodecConfigurationV1 {
/// Whether or not to write headers.
///
Expand Down

0 comments on commit 58fcf95

Please sign in to comment.