You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by kr...@apache.org on 2026/02/11 10:34:08 UTC
(avro-rs) branch fix/suggest_boolean_for_bool created (now d9016f0)
This is an automated email from the ASF dual-hosted git repository.
kriskras99 pushed a change to branch fix/suggest_boolean_for_bool
in repository https://gitbox.apache.org/repos/asf/avro-rs.git
at d9016f0 fix: Suggest `boolean` when `bool` is used
This branch includes the following new commits:
new d9016f0 fix: Suggest `boolean` when `bool` is used
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(avro-rs) 01/01: fix: Suggest `boolean` when `bool` is used
Posted by kr...@apache.org.
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 <gi...@kriskras99.nl>
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)?;