Skip to content
Open
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
15 changes: 14 additions & 1 deletion avro/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,21 @@ pub enum Details {
#[error("Duplicate enum symbol {0}")]
EnumSymbolDuplicate(String),

#[error("Default value for enum must be a string! Got: {0}")]
#[error("Default value for an enum must be a string! Got: {0}")]
EnumDefaultWrongType(serde_json::Value),

#[error("Default value for an array must be an array! Got: {0}")]
ArrayDefaultWrongType(serde_json::Value),

#[error("Default value for an array must be an array of {0}! Found: {1:?}")]
ArrayDefaultWrongInnerType(Schema, Value),

#[error("Default value for a map must be a object! Got: {0}")]
MapDefaultWrongType(serde_json::Value),

#[error("Default value for a map must be a object with (String, {0})! Found: (String, {1:?})")]
MapDefaultWrongInnerType(Schema, Value),
Comment on lines +437 to +447
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Grammar: "a object" → "an object" in map error messages.

Lines 443 and 446 use "a object" which is grammatically incorrect.

✏️ Proposed fix
-    #[error("Default value for a map must be a object! Got: {0}")]
+    #[error("Default value for a map must be an object! Got: {0}")]
     MapDefaultWrongType(serde_json::Value),

-    #[error("Default value for a map must be a object with (String, {0})! Found: (String, {1:?})")]
+    #[error("Default value for a map must be an object with (String, {0})! Found: (String, {1:?})")]
     MapDefaultWrongInnerType(Schema, Value),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[error("Default value for an array must be an array! Got: {0}")]
ArrayDefaultWrongType(serde_json::Value),
#[error("Default value for an array must be an array of {0}! Found: {1:?}")]
ArrayDefaultWrongInnerType(Schema, Value),
#[error("Default value for a map must be a object! Got: {0}")]
MapDefaultWrongType(serde_json::Value),
#[error("Default value for a map must be a object with (String, {0})! Found: (String, {1:?})")]
MapDefaultWrongInnerType(Schema, Value),
#[error("Default value for an array must be an array! Got: {0}")]
ArrayDefaultWrongType(serde_json::Value),
#[error("Default value for an array must be an array of {0}! Found: {1:?}")]
ArrayDefaultWrongInnerType(Schema, Value),
#[error("Default value for a map must be an object! Got: {0}")]
MapDefaultWrongType(serde_json::Value),
#[error("Default value for a map must be an object with (String, {0})! Found: (String, {1:?})")]
MapDefaultWrongInnerType(Schema, Value),
🤖 Prompt for AI Agents
In `@avro/src/error.rs` around lines 437 - 447, Update the error strings for
MapDefaultWrongType and MapDefaultWrongInnerType to fix the grammar ("a object"
→ "an object"); locate the enum variants MapDefaultWrongType and
MapDefaultWrongInnerType in error.rs and change their #[error(...)] messages to
use "an object" (and ensure the rest of the messages remain unchanged).


#[error("No `items` in array")]
GetArrayItemsField,

Expand All @@ -446,6 +458,7 @@ pub enum Details {
#[error("Fixed schema has no `size`")]
GetFixedSizeField,

#[deprecated(since = "0.22.0", note = "This error variant is not generated anymore")]
#[error("Fixed schema's default value length ({0}) does not match its size ({1})")]
FixedDefaultLenSizeMismatch(usize, u64),

Expand Down
Loading