Class JsonRowSchemaConverter


  • public final class JsonRowSchemaConverter
    extends Object
    Converts a JSON schema into Flink's type information. It uses Row for representing objects and tuple arrays.

    Note: This converter implements just a subset of the JSON schema specification. Union types (as well as "allOf", "anyOf", "not") are not supported yet. Simple references that link to a common definition in the document are supported. "oneOf" and arrays of types are only supported for specifying nullability.

    This converter has been developed for JSON Schema draft-07 but also includes keywords of older drafts to be as compatible as possible.

    • Method Detail

      • convert

        public static <T> org.apache.flink.api.common.typeinfo.TypeInformation<T> convert​(String jsonSchema)
        Converts a JSON schema into Flink's type information. Throws an exception if the schema cannot converted because of loss of precision or too flexible schema.

        The converter can resolve simple schema references to solve those cases where entities are defined at the beginning and then used throughout a document.