This is an automated email from the ASF dual-hosted git repository. kriskras99 pushed a commit to branch fix/suggest_boolean_for_bool in repository https://gitbox.apache.org/repos/asf/avro-rs.git
commit d9016f08cda267b1e4b43145cc18f612b0773314 Author: Kriskras99 <[email protected]> AuthorDate: Wed Feb 11 11:33:58 2026 +0100 fix: Suggest `boolean` when `bool` is used --- avro/src/error.rs | 3 +++ avro/src/schema/parser.rs | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/avro/src/error.rs b/avro/src/error.rs index ea81125..b3ff452 100644 --- a/avro/src/error.rs +++ b/avro/src/error.rs @@ -358,6 +358,9 @@ pub enum Details { #[error("Unknown primitive type: {0}")] ParsePrimitive(String), + #[error("Unknown primitive type: {0}, did you mean {1}?")] + ParsePrimitiveSimilar(String, &'static str), + #[error("invalid JSON for {key:?}: {value:?}")] GetDecimalMetadataValueFromJson { key: String, diff --git a/avro/src/schema/parser.rs b/avro/src/schema/parser.rs index 704f56b..eb1b849 100644 --- a/avro/src/schema/parser.rs +++ b/avro/src/schema/parser.rs @@ -187,7 +187,14 @@ impl Parser { .input_schemas .remove(&fully_qualified_name) // TODO make a better descriptive error message here that conveys that a named schema cannot be found - .ok_or_else(|| Details::ParsePrimitive(fully_qualified_name.fullname(None)))?; + .ok_or_else(|| { + let full_name = fully_qualified_name.fullname(None); + if full_name == "bool" { + Details::ParsePrimitiveSimilar(full_name, "boolean") + } else { + Details::ParsePrimitive(full_name) + } + })?; // parsing a full schema from inside another schema. Other full schema will not inherit namespace let parsed = self.parse(&value, &None)?;
