Mailing list thread: https://lists.apache.org/thread/ydslz3h8ymjjwm5ng02kwszmc5j5hy30
Now, don‘t register logical type conversions when use SchemaDefinition.<T>builder().withJsonDef()
to create the schema, beacase it without classLoader param. (e.g: https://github.com/apache/pulsar/issues/15899)
We can add the classLoader field for SchemaDefinition, user can manually pass a classLoader to register logical type conversions
This proposes to add the classLoader field for SchemaDefinition. When using SchemaDefinition.<T>builder().withJsonDef()
to create the schema it must manually specify a classLoader otherwise, the converter will not work.
The priority of the classLoader field will be higher than by the pojoClass.getClassLoader()
.
public class SchemaDefinitionBuilder { //.... /** * Set schema of pojo classLoader. * * @param classLoader pojo classLoader * * @return schema definition builder */ SchemaDefinitionBuilder<T> withClassLoader(ClassLoader classLoader); }
public class SchemaDefinition { //.... /** * Get pojo classLoader. * * @return pojo schema */ ClassLoader getClassLoader(); }
Add the classloader field for SchemaDefinition.