Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema namespace conflicts with Java package names #3

Open
Zarquan opened this issue Sep 21, 2018 · 0 comments
Open

Schema namespace conflicts with Java package names #3

Zarquan opened this issue Sep 21, 2018 · 0 comments

Comments

@Zarquan
Copy link

Zarquan commented Sep 21, 2018

The current schema namespaces are not compatible with the Java class generators from the Apache Avro project.

The Avro code generator creates Java classes for each top level object in the Avro schema, along with all of the serializing and deserializing code needed read and write them. See Serializing and deserializing with code generation and Using Avro's code generation from Maven.

The Avro code generator maps the schema namespace as the Java package name, and the schema object name as the Java class name. For the ZFT schema this means it tries to create the following four classes:

  • ztf.alert
  • ztf.alert.cutout
  • ztf.alert.candidate
  • ztf.alert.prv_candidate

For the top level alert, the package name is ztf and the class name is alert. For the other three classes, the package name is ztf.alert and the class names are cutout, candidate and prv_candidate. This means that the full name of the ztf.alert class conflicts with the package name of the other three classes.

We solved the problem locally by manually tweaking the schema before we generate the Java classes, but it would be good to avoid this in the future. Next time we generate a new schema version can we change the schema namespaces to avoid this conflict. Suggested fix would be to make all four classes have the same namespace e.g.

  • ztf.alert
  • ztf.cutout
  • ztf.candidate
  • ztf.prv_candidate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant