-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
[Avro] Generate logicalType switch #290
Comments
Yeah that visitor system is... not great. Came originally as a contribution for generating JSON Schema. |
Ok, yes. So, there is
It does get bit convoluted but I hope above helps you find access you need. |
Hmmm :( With
One way is to create a toggle method in AvroMapper mapper = AvroMapper.builder()
.addModule(new AvroJavaTimeModule())
.build();
AvroSchemaGenerator gen = new AvroSchemaGenerator();
gen.enableLogicalTypes(); // Enable logicalType suport
mapper.acceptJsonFormatVisitor(testClass, gen);
Schema actualSchema = gen.getGeneratedSchema().getAvroSchema(); I do not know, .... I keep searching .... |
@MichalFoksa there should be a way via If I have time today, I'll see what could be done here. |
Hmmmh. So, Given this, your approach may be the way to go; and the only (?) question being whether to enable them by default, or to require specific call. There probably needs to be matching I think it also makes sense to extract methods in such a way that sub-classing could be used by developers if necessary to change call logic. |
Thank you, I thought so. Will look at it later and post a PR next week. |
@cowtowncoder Better start review with #292 - switch is build upon it. |
Hi @cowtowncoder
I want to implement a toggle to enable / disable
logicalType
generation in Avro schema. I am bit lost here, I do not know where to add new feature, whether toAvroGenerator.Feature
,AvroMapper.Feature
orAvroParser
.When I start backwards, I do know how to check whether the feature is enable. I have in my mind following implementation in
VisitorFormatWrapperImpl
:My Question is: How to make
if (GENERATE_LOGICAL_TYPE feature enabled)
condition?Cheers,
Michal
The text was updated successfully, but these errors were encountered: