[
https://issues.apache.org/jira/browse/AVRO-4077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18029499#comment-18029499
]
David Neukam commented on AVRO-4077:
------------------------------------
I think I ran into the same issue [~andreaswillichlutz]. I created a PR for
this issue. See AVRO-4187 / [https://github.com/apache/avro/pull/3516]
> Namespace mapping is applied to internal Schema string
> ------------------------------------------------------
>
> Key: AVRO-4077
> URL: https://issues.apache.org/jira/browse/AVRO-4077
> Project: Apache Avro
> Issue Type: Bug
> Components: csharp
> Affects Versions: 1.12.0
> Reporter: Andreas Willich
> Priority: Major
>
> When I use the .NET avrogen CLI tool to generate the .NET classes and use a
> namespace mapping, not only is the .NET Namespace changed, but also the
> schema string in the generated code.
>
> *Avro Type:*
>
> {code:java}
> {
> "namespace": "some.namespace",
> "type": "record",
> "name": "ATypeInNamespace",
> "fields": [
> {
> "name": "property",
> "type": "string"
> }
> ]
> } {code}
>
> *Cmd (Windows)*
> {code:java}
> dotnet avrogen -s .\type.avro .\output --namespace
> some.namespace:A.DotNET.Namespace {code}
> *Generated Code:*
> {code:java}
> //
> ------------------------------------------------------------------------------
> // <auto-generated>
> // Generated by avrogen, version
> 1.12.0+8c27801dc8d42ccc00997f25c0b8f45f8d4a233e
> // Changes to this file may cause incorrect behavior and will be lost if
> code
> // is regenerated
> // </auto-generated>
> //
> ------------------------------------------------------------------------------
> namespace A.DotNET.Namespace
> {
> using System;
> using System.Collections.Generic;
> using System.Text;
> using global::Avro;
> using global::Avro.Specific;
>
> [global::System.CodeDom.Compiler.GeneratedCodeAttribute("avrogen",
> "1.12.0+8c27801dc8d42ccc00997f25c0b8f45f8d4a233e")]
> public partial class ATypeInNamespace :
> global::Avro.Specific.ISpecificRecord
> {
> public static global::Avro.Schema _SCHEMA =
> global::Avro.Schema.Parse("{\"type\":\"record\",\"name\":\"ATypeInNamespace\",\"namespace\":\"A.DotNET.Namespace\",\"fiel"
> +
> "ds\":[{\"name\":\"property\",\"type\":\"string\"}]}");
> private string _property;
> public virtual global::Avro.Schema Schema
> {
> get
> {
> return ATypeInNamespace._SCHEMA;
> }
> }
>
> //removed to keep it small
> }
> } {code}
> As you can see, the namespace property is now "A.DotNET.Namespace" and not
> "some.namespace" anymore.
>
>
> Repository with example to reproduce:
> [https://github.com/AndreasWillichXXXLutz/AvroIssueNamespaceMapping]
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)