You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was hoping to override the namespace used in the schemas generated by AvroSchemaGenerator for my POJOs, as opposed to the package name that is used (as it does not make sense to the consumers of my topic, outside of my application).
I cannot workout a means to do this, I tried @JsonRootName(value = "ClassName", namespace = "my.domain") but that is not picked up, is there any other means to achieve this?
Note this is not the same as @JsonAlias, I would like to control the namespace, not the aliases.
Code currently used:
public static AvroSchema generateSchema(final Class<?> clazz) {
final AvroSchemaGenerator gen = new AvroSchemaGenerator();
gen.enableLogicalTypes();
try {
MAPPER.acceptJsonFormatVisitor(clazz, gen);
} catch (JsonMappingException e) {
throw new IllegalArgumentException("Cannot generate schema for: " + clazz, e);
}
return gen.getGeneratedSchema();
}
The text was updated successfully, but these errors were encountered:
cowtowncoder
changed the title
Avro schema generation - Override namespace
Avro schema generation: allow override namespace with new @AvroNamespace annotation
May 15, 2022
I was hoping to override the namespace used in the schemas generated by
AvroSchemaGenerator
for my POJOs, as opposed to the package name that is used (as it does not make sense to the consumers of my topic, outside of my application).I cannot workout a means to do this, I tried
@JsonRootName(value = "ClassName", namespace = "my.domain")
but that is not picked up, is there any other means to achieve this?Note this is not the same as
@JsonAlias
, I would like to control the namespace, not thealiases
.Code currently used:
The text was updated successfully, but these errors were encountered: