Closed dario-davi closed 1 year ago
Hello, I think ./RawResponse_1.json
is interpreted as a directory.
Could you try like that:
./.cargo/bin/rsgen-avro RawResponse_1.json -
Could you provide your schema if this is not the issue ?
Hi,
with ./.cargo/bin/rsgen-avro RawResponse_1.json -
I have the same result.
The schema is here: https://pastebin.com/nXku4LNN
Thanks
Thank you for the schema.
First of all you need to change a bit the structure for it to be valid. Currently you have something like this:
{
"schema" : {},
"schemaType" : "AVRO",
"references" : [ ]
}
But you have to extract only the "schema"
part and put it in a file, so that the content is like this:
{
"type" : "record",
"name" : "RawResponseToUploadDtoV1d0",
"namespace" : "com.enel.sb.ms.normalizer.dto.events.output",
[...]
}
With this correct schema I gave it a try with the latest rsgen-avro
which is 0.11.8 (downloaded from the release page) :
rsgen-avro schema.avsc -
But it fails with:
thread 'main' panicked at 'Ref `Name { name: "RegisterValueDto", namespace: None }` is not resolved. Schema: Ref { name: Name { name: "RegisterValueDto", namespace: None } }', src/templates.rs:298:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I will investigate it further ...
Ok thanks
I have released version 0.11.9
that you can download from the release page that fixes the issues you encountered.
However there is 1 change required to your schema. When you use RegisterValueDto
as a value in a map you currently have:
{
"type" : "map",
"values" : "RegisterValueDto"
}
But for rsgen-avro
to work you need to write its fully-qualified name as follows:
{
"type" : "map",
"values" : "com.enel.sb.ms.normalizer.dto.events.output.common.RegisterValueDto"
}
Let me know if that works for you.
OK ,thank you very much, I will try! The only strange thing is that I generate that avro schema from existing java classes using avro official java library: it's very strange that it creates an out of standard schema.
The schema is standard as is (I tried to use it to generate some random data in avro format). But for apache-avro in Rust to parse the schema correctly it seems necessary to have fully-qualified names here.
Hi, I think it's working correctly, thanks
Hi,
whene I run the following command
./.cargo/bin/rsgen-avro ./RawResponse_1.json -
I get the following errorTemplating error: Io error while writing rendered value to output: NotADirectory
My Avro schemma is preatty long, if you need I can link it, but it seems a problem with paths, not with schema content.
Thanks, Dario