You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by Andreas Hailu <an...@gmail.com> on 2021/06/01 15:07:21 UTC
SchemaBuilder: Support making validation of default values
configurable
Hello,
The SchemaBuilder's createFields methods pass a value of 'true' to the validateDefault option within the Field constructor. While this is very useful to have, it results in us not being able to seamlessly migrate from 1.8 to >= 1.9 as our registry already has schemata with invalid defaults. This results
Given that Schema.Parser allows us to configure this, what are your thoughts on supporting the same idea within SchemaBuilder? I created a JIRA [1] with some details and would be happy to contribute if we’d like to support this.
[1] https://issues.apache.org/jira/browse/AVRO-3144 <https://issues.apache.org/jira/browse/AVRO-3144>
Best,
Andreas | www.andreashailu.com <http://www.andreashailu.com/>
Re: SchemaBuilder: Support making validation of default values
configurable
Posted by Andreas Hailu <an...@gmail.com>.
I’ve opened a pull request for this feature here: https://github.com/apache/avro/pull/1276 <https://github.com/apache/avro/pull/1276>
It’s succinct. If someone would kindly have a review and let me know their thoughts, it would be greatly appreciated!
Best,
Andreas | www.andreashailu.com <http://www.andreashailu.com/>
> On Jun 20, 2021, at 10:12 AM, Andreas Hailu <an...@gmail.com> wrote:
>
> I was able to get something working locally that supports this kind of feature while staying true to the fluent-style of the SchemaBuilder. A snippet from a test I wrote to see what it looks like:
>
> SchemaBuilder.record("ValidationRecord")
> .fields()
> .name("IntegerField")
> .notValidatingDefaults()
> .type("int")
> .withDefault(“foo”)
> .endRecord();
>
> Thoughts? If this is something we’d like to support, I can open a pull request for review.
>
> Best,
> Andreas | www.andreashailu.com <http://www.andreashailu.com/>
>
>
>
>
>> On Jun 1, 2021, at 11:12 AM, Andreas Hailu <andreashailu@gmail.com <ma...@gmail.com>> wrote:
>>
>> Fixed a typo inline in the previous message - apologies.
>>
>>
>>> On Jun 1, 2021, at 11:07 AM, Andreas Hailu <andreashailu@gmail.com <ma...@gmail.com>> wrote:
>>>
>>> Hello,
>>> The SchemaBuilder's createFields methods pass a value of 'true' to the validateDefault option within the Field constructor. While this is very useful to have, it results in not being able to seamlessly migrate from 1.8 to >= 1.9 if an application/schema registry already has schemata with invalid defaults.
>>>
>>> Given that Schema.Parser allows us to configure this, what are your thoughts on supporting the same idea within SchemaBuilder? I created a JIRA [1] with some details and would be happy to contribute if we’d like to support this.
>>>
>>> [1] https://issues.apache.org/jira/browse/AVRO-3144 <https://issues.apache.org/jira/browse/AVRO-3144>
>>>
>>> Best,
>>> Andreas | www.andreashailu.com <http://www.andreashailu.com/>
>>>
>>>
>>>
>>>
>>
>
Re: SchemaBuilder: Support making validation of default values
configurable
Posted by Andreas Hailu <an...@gmail.com>.
I was able to get something working locally that supports this kind of feature while staying true to the fluent-style of the SchemaBuilder. A snippet from a test I wrote to see what it looks like:
SchemaBuilder.record("ValidationRecord")
.fields()
.name("IntegerField")
.notValidatingDefaults()
.type("int")
.withDefault(“foo”)
.endRecord();
Thoughts? If this is something we’d like to support, I can open a pull request for review.
Best,
Andreas | www.andreashailu.com <http://www.andreashailu.com/>
> On Jun 1, 2021, at 11:12 AM, Andreas Hailu <an...@gmail.com> wrote:
>
> Fixed a typo inline in the previous message - apologies.
>
>
>> On Jun 1, 2021, at 11:07 AM, Andreas Hailu <andreashailu@gmail.com <ma...@gmail.com>> wrote:
>>
>> Hello,
>> The SchemaBuilder's createFields methods pass a value of 'true' to the validateDefault option within the Field constructor. While this is very useful to have, it results in not being able to seamlessly migrate from 1.8 to >= 1.9 if an application/schema registry already has schemata with invalid defaults.
>>
>> Given that Schema.Parser allows us to configure this, what are your thoughts on supporting the same idea within SchemaBuilder? I created a JIRA [1] with some details and would be happy to contribute if we’d like to support this.
>>
>> [1] https://issues.apache.org/jira/browse/AVRO-3144 <https://issues.apache.org/jira/browse/AVRO-3144>
>>
>> Best,
>> Andreas | www.andreashailu.com <http://www.andreashailu.com/>
>>
>>
>>
>>
>
Re: SchemaBuilder: Support making validation of default values
configurable
Posted by Andreas Hailu <an...@gmail.com>.
Fixed a typo inline in the previous message - apologies.
> On Jun 1, 2021, at 11:07 AM, Andreas Hailu <an...@gmail.com> wrote:
>
> Hello,
> The SchemaBuilder's createFields methods pass a value of 'true' to the validateDefault option within the Field constructor. While this is very useful to have, it results in not being able to seamlessly migrate from 1.8 to >= 1.9 if an application/schema registry already has schemata with invalid defaults.
>
> Given that Schema.Parser allows us to configure this, what are your thoughts on supporting the same idea within SchemaBuilder? I created a JIRA [1] with some details and would be happy to contribute if we’d like to support this.
>
> [1] https://issues.apache.org/jira/browse/AVRO-3144 <https://issues.apache.org/jira/browse/AVRO-3144>
>
> Best,
> Andreas | www.andreashailu.com <http://www.andreashailu.com/>
>
>
>
>