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
Moving the discussion from #33 here
Status quo:
Internally there-was-no-default-set is used for no default and in the annotation you need to use empty-string-default as empty string default value. @Hubbitus input was:
Honestly it is not so important for me but looks very ugly. What is the problem to provide @avro-default '', @avro-default null, @avro-default 'null'
So internally i have defined a constant PhpClassPropertyInterface::NO_DEFAULT with the value there-was-no-default-set. This is necessary to identify if the user didn't use the @avro-default annotation, so i won't add it to the generated schema.
Other values like empty string, null etc. are not suitable, since they are real default values.
It is more of an internal implementation detail so i think it doesn't matter. I chose a long string, to minimize chances of somebody using it as a real default value
Regarding @avro-default '' vs @avro-default empty-string-default, this would be possible, but for consistency's sake, i would need to have all string in quotes then, which i wanted to avoid, since i need to add more parsing complexity to the library and i think the parsing part is complex as it is. If it is needed in the future for other usecases, we can still add it, but i wanted to keep it simple for now
@avro-default null, this is possible since alpha3 and will result in default: null in the schema
@avro-default 'null', since i don't support quotes, that is not really possible right now to have the string null as default, this is one of the flaws of what i mentioned in point 2.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Moving the discussion from #33 here
Status quo:
Internally
there-was-no-default-set
is used for no default and in the annotation you need to useempty-string-default
as empty string default value.@Hubbitus input was:
Honestly it is not so important for me but looks very ugly. What is the problem to provide @avro-default '', @avro-default null, @avro-default 'null'
Beta Was this translation helpful? Give feedback.
All reactions