Class ProtobufSchemaLoader

java.lang.Object
io.apicurio.registry.utils.protobuf.schema.ProtobufSchemaLoader

public class ProtobufSchemaLoader extends Object
  • Constructor Details

    • ProtobufSchemaLoader

      public ProtobufSchemaLoader()
  • Method Details

    • loadSchema

      public static ProtobufSchemaLoader.ProtobufSchemaLoaderContext loadSchema(Optional<String> packageName, String fileName, String schemaDefinition) throws IOException
      Creates a schema loader using a in-memory file system. This is required for square wire schema parser and linker to load the types correctly. See https://github.com/square/wire/issues/2024# As of now this only supports reading one .proto file but can be extended to support reading multiple files.
      Parameters:
      packageName - Package name for the .proto if present
      fileName - Name of the .proto file.
      schemaDefinition - Schema Definition to parse.
      Returns:
      Schema - parsed and properly linked Schema.
      Throws:
      IOException
    • loadSchema

      public static ProtobufSchemaLoader.ProtobufSchemaLoaderContext loadSchema(Optional<String> packageName, String fileName, String schemaDefinition, Map<String,String> deps) throws IOException
      Creates a schema loader using a in-memory file system. This is required for square wire schema parser and linker to load the types correctly. See https://github.com/square/wire/issues/2024# As of now this only supports reading one .proto file but can be extended to support reading multiple files.
      Parameters:
      packageName - Package name for the .proto if present
      fileName - Name of the .proto file.
      schemaDefinition - Schema Definition to parse.
      schemaDefinition - Schema Definition to parse.
      Returns:
      Schema - parsed and properly linked Schema.
      Throws:
      IOException