[
https://issues.apache.org/jira/browse/AVRO-3452?focusedWorklogId=745498&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-745498
]
ASF GitHub Bot logged work on AVRO-3452:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Mar/22 22:45
Start Date: 21/Mar/22 22:45
Worklog Time Spent: 10m
Work Description: jklamer commented on a change in pull request #1615:
URL: https://github.com/apache/avro/pull/1615#discussion_r831601581
##########
File path: lang/rust/avro/src/schema.rs
##########
@@ -335,6 +335,25 @@ impl fmt::Display for Name {
}
}
+impl<'de> Deserialize<'de> for Name {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: serde::de::Deserializer<'de>,
+ {
+ serde_json::Value::deserialize(deserializer).and_then(|value| {
+ use serde::de::Error;
+ if let Value::Object(json) = value {
+ Name::parse(&json).map_err(D::Error::custom)
Review comment:
Would there ever be a situation where this is used to parse a JSON Value
of a string? Probably not because full schema parsing will always probably be
routed through the parser I imagine?
--
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: 745498)
Time Spent: 0.5h (was: 20m)
> [rust] Derive Deserialize produces invalid Name struct
> -------------------------------------------------------
>
> Key: AVRO-3452
> URL: https://issues.apache.org/jira/browse/AVRO-3452
> Project: Apache Avro
> Issue Type: Bug
> Components: rust
> Reporter: Jack Klamer
> Assignee: Martin Tzvetanov Grigorov
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> The Name struct derives the trait Deserialize, which allows it to be
> constructed from a JSON as shown in this test:
> [https://github.com/apache/avro/blob/master/lang/rust/avro/tests/schema.rs#L1080]
> (called test_fullname_fullname_and_namespace_specified())
> However, the derive flow does not parse out the namespace from the name which
> is handled correctly from both Name::new() and Name:: parse() , which leads
> to a struct this is invalid against what is expected.
> It would be nice to remove the derive Deserialize trait, and replace with a
> custom implementation or just removing the implementation all together (and
> double checking for side effects of that)
--
This message was sent by Atlassian Jira
(v8.20.1#820001)