Open
Conversation
martin-g
reviewed
Feb 23, 2026
Member
martin-g
left a comment
There was a problem hiding this comment.
Here are some comments on the proposed changes in this PR.
But as I commented at #476 (comment) the Java and Python SDKs do support parsing such flat schemas too.
| assert_eq!(expected, err); | ||
| assert_eq!( | ||
| Schema::parse_str(schema_str).unwrap_err().to_string(), | ||
| "`default`'s value type of field `f1` in `ns.record1` must be a `{\"name\":\"ns.record2\",\"type\":\"record\",\"fields\":[{\"name\":\"f1_1\",\"type\":\"int\"}]}`. Got: String(\"invalid\")" |
Member
There was a problem hiding this comment.
nit: Let's use raw string to make a bit more readable. r#"..."#
Same for the other similar assertions.
| let result = Schema::parse_str(schema_str).unwrap_err(); | ||
| assert_eq!( | ||
| result.to_string(), | ||
| "Invalid schema: There is no type called 'enum', if you meant to define a non-primitive schema, it should be defined inside `type` attribute. Please review the specification" |
Member
There was a problem hiding this comment.
Suggested change
| "Invalid schema: There is no type called 'enum', if you meant to define a non-primitive schema, it should be defined inside `type` attribute. Please review the specification" | |
| "Invalid schema: There is no type called 'enum', if you meant to define a non-primitive schema, it should be defined inside `type` attribute. Please consult with the specification" |
| #[error("No `type` in complex type")] | ||
| GetComplexTypeField, | ||
|
|
||
| #[error("No `type` in in record field")] |
Member
There was a problem hiding this comment.
Suggested change
| #[error("No `type` in in record field")] | |
| #[error("No `type` in record field")] |
|
|
||
| if let Some(logical_type) = field.get("logicalType") { | ||
| warn!( | ||
| "Ignored the {enclosing_record}.logicalType property (`{logical_type}`). It should probably be nested instide the `type` for the field" |
Member
There was a problem hiding this comment.
Suggested change
| "Ignored the {enclosing_record}.logicalType property (`{logical_type}`). It should probably be nested instide the `type` for the field" | |
| "Ignored the {enclosing_record}.logicalType property (`{logical_type}`). It should probably be nested inside the `type` for the field" |
| for (key, value) in field { | ||
| match key.as_str() { | ||
| "type" | "name" | "doc" | "default" | "order" | "position" | "aliases" | ||
| | "logicalType" => continue, |
Member
There was a problem hiding this comment.
This needs reworking too.
logicalType, symbols, size, items and values cannot be at that level anymore.
| field_schema.canonical_form(), | ||
| field_schema | ||
| .independent_canonical_form(&schemata) | ||
| .unwrap_or("Unknown".to_string()), |
Member
There was a problem hiding this comment.
How about falling back to the canonical form instead of this "Unknown" ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will break code, as it no longer accepts invalid schemas.
Closes #476