Skip to content

Commit

Permalink
Merge branch '2.19'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 13, 2024
2 parents 507ea4a + d967e8b commit 5d21364
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import tools.jackson.databind.introspect.AnnotatedClass;
import tools.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor;
import tools.jackson.databind.jsonFormatVisitors.JsonValueFormat;
import tools.jackson.databind.type.TypeFactory;

public class StringVisitor extends JsonStringFormatVisitor.Base
implements SchemaBuilder
Expand All @@ -38,7 +37,8 @@ public void enumTypes(Set<String> enums) {
public Schema builtAvroSchema() {
// Unlike Jackson, Avro treats characters as an int with the java.lang.Character class type.
if (_type.hasRawClass(char.class) || _type.hasRawClass(Character.class)) {
return AvroSchemaHelper.numericAvroSchema(NumberType.INT, TypeFactory.defaultInstance().constructType(Character.class));
// should we construct JavaType for `Character.class` in case of primitive or... ?
return AvroSchemaHelper.numericAvroSchema(NumberType.INT, _type);
}
// [dataformats-binary#179]: need special help with UUIDs, to coerce into Binary
// (could actually be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
@RunWith(Parameterized.class)
public class DateTimeVisitor_builtAvroSchemaTest {

private static final TypeFactory TYPE_FACTORY = TypeFactory.defaultInstance();

@Parameter(0)
public Class<?> testClass;

Expand Down Expand Up @@ -73,14 +71,16 @@ public static Collection<?> testData() {
LocalTime.class,
JsonParser.NumberType.INT,
Schema.Type.INT,
"time-millis"},
"time-millis"
}
});
}

@Test
public void builtAvroSchemaTest() {
// GIVEN
DateTimeVisitor dateTimeVisitor = new DateTimeVisitor(TYPE_FACTORY.constructSimpleType(testClass, null));
final TypeFactory tf = TypeFactory.createDefaultInstance();
DateTimeVisitor dateTimeVisitor = new DateTimeVisitor(tf.constructSimpleType(testClass, null));
dateTimeVisitor.numberType(givenNumberType);

// WHEN
Expand Down

0 comments on commit 5d21364

Please sign in to comment.