[
https://issues.apache.org/jira/browse/AVRO-3302?focusedWorklogId=711135&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-711135
]
ASF GitHub Bot logged work on AVRO-3302:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Jan/22 07:15
Start Date: 19/Jan/22 07:15
Worklog Time Spent: 10m
Work Description: martin-g commented on pull request #1456:
URL: https://github.com/apache/avro/pull/1456#issuecomment-1016149568
Tested https://github.com/lerouxrgd/rsgen-avro.git:
```diff
diff --git Cargo.toml Cargo.toml
index 7812704..64fd6cd 100644
--- Cargo.toml
+++ Cargo.toml
@@ -10,7 +10,7 @@ license = "MIT"
readme = "README.md"
[dependencies]
-avro-rs = "0.13"
+avro-rs = { git = "https://github.com/martin-g/avro",
branch="avro-3302-add-interop-tests-for-rust" }
docopt = "1"
glob = "0.3"
heck = "0.4"
diff --git src/templates.rs src/templates.rs
index 1d7f80b..17fa496 100644
--- src/templates.rs
+++ src/templates.rs
@@ -238,6 +238,7 @@ impl Templater {
if let Schema::Fixed {
name: Name { name, .. },
size,
+ ..
} = schema
{
let mut ctx = Context::new();
@@ -316,6 +317,7 @@ impl Templater {
o.insert(name_std.clone(), name);
match schema {
+ Schema::Ref { name: _ } => { todo!() }
Schema::Boolean => {
let default = self.parse_default(schema, gen_state,
default.as_ref())?;
f.push(name_std.clone());
@@ -496,6 +498,7 @@ impl Templater {
let mut visitors = vec![];
for sc in schemas {
let symbol_str = match sc {
+ Schema::Ref { name: _ } => todo!(),
Schema::Boolean => "Boolean(bool)".into(),
Schema::Int => "Int(i32)".into(),
Schema::Long => "Long(i64)".into(),
@@ -595,6 +598,7 @@ impl Templater {
default: Option<&serde_json::Value>,
) -> Result<String> {
let default_str = match schema {
+ Schema::Ref { name: _ } => todo!(),
Schema::Boolean => match default {
Some(Value::Bool(b)) => b.to_string(),
None => bool::default().to_string(),
@@ -692,6 +696,7 @@ impl Templater {
Schema::Fixed {
name: Name { name: f_name, .. },
size,
+ ..
} => match default {
Some(Value::String(s)) => {
let bytes = s.clone().into_bytes();
@@ -709,6 +714,7 @@ impl Templater {
Schema::Fixed {
name: Name { name: f_name, .. },
size,
+ ..
} => match default {
Some(Value::String(s)) => {
let bytes = s.clone().into_bytes();
@@ -937,6 +943,10 @@ pub(crate) fn array_type(inner: &Schema, gen_state:
&GenState) -> Result<String>
| Schema::Enum {
name: Name { name, .. },
..
+ }
+ | Schema::Ref {
+ name: Name { name, .. },
+ ..
} => format!("Vec<{}>", &sanitize(name.to_upper_camel_case())),
Schema::Null => err!("Invalid use of Schema::Null")?,
@@ -951,6 +961,7 @@ pub(crate) fn map_type(inner: &Schema, gen_state:
&GenState) -> Result<String> {
}
let type_str = match inner {
+ Schema::Ref { name: _ } => map_of("String"),
Schema::Boolean => map_of("bool"),
Schema::Int => map_of("i32"),
Schema::Long => map_of("i64"),
@@ -1003,6 +1014,7 @@ pub(crate) fn map_type(inner: &Schema, gen_state:
&GenState) -> Result<String> {
fn union_enum_variant(schema: &Schema, gen_state: &GenState) ->
Result<String> {
let variant_str = match schema {
+ Schema::Ref { name: _ } => "String".into(),
Schema::Boolean => "Boolean".into(),
Schema::Int => "Int".into(),
Schema::Long => "Long".into(),
@@ -1080,6 +1092,7 @@ pub(crate) fn union_type(
/// Generates the Rust type of the inner schema of an Avro optional union.
pub(crate) fn option_type(inner: &Schema, gen_state: &GenState) ->
Result<String> {
let type_str = match inner {
+ Schema::Ref { name: _ } => "Option<String>".into(),
Schema::Boolean => "Option<bool>".into(),
Schema::Int => "Option<i32>".into(),
```
```
$ cargo test
```
No failures!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 711135)
Time Spent: 1.5h (was: 1h 20m)
> Rust: Implement interop tests for the Rust module
> -------------------------------------------------
>
> Key: AVRO-3302
> URL: https://issues.apache.org/jira/browse/AVRO-3302
> Project: Apache Avro
> Issue Type: Improvement
> Components: rust
> Reporter: Martin Tzvetanov Grigorov
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> It would be good to add interop tests for the Rust module.
> This will show if some functionality is still missing and prevent regressions
> in the future!
--
This message was sent by Atlassian Jira
(v8.20.1#820001)