-
Notifications
You must be signed in to change notification settings - Fork 26
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
Force avro String type in generated schema #730
Conversation
implicit val afString: AvroField[String] = new Aux[String, String, String] { | ||
override protected def buildSchema(cm: CaseMapper): Schema = { | ||
val schema = Schema.create(Schema.Type.STRING) | ||
GenericData.setStringType(schema, GenericData.StringType.String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about this method! nice
ff011d0
to
982ed24
Compare
implicit val afUnit = | ||
aux2[Unit, JsonProperties.Null](Schema.Type.NULL)(_ => ())(_ => JsonProperties.NULL_VALUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why we had this. The generated data looked incorrect and having a data model containing a Unit
field looks wrong to me. I replaced with a afNull
in case we want to get a schema with null type.
Codecov Report
@@ Coverage Diff @@
## main #730 +/- ##
==========================================
- Coverage 94.99% 94.97% -0.03%
==========================================
Files 52 52
Lines 1779 1790 +11
Branches 169 171 +2
==========================================
+ Hits 1690 1700 +10
- Misses 89 90 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
scala/java
String
will be represented in with the"avro.java.string": "String"
property in the avro schema.Logical types baked by avro string should be created using the
CharSequence
type as the property is forbidden there (exception is thrown when building the schema)