generate

Generates C# code for a schema from the Schema Registry.

Examples

Generate code for a schema by ID
$ dotnet avro generate --id 120 --registry-url http://registry:8081
namespace Example.Models
{
    public class ExampleModel
    {
        public string Text { get; set; }
    }
}
Generate code for a schema by ID, connecting to the Schema Registry using basic auth
$ dotnet avro generate --id 120 --registry-url http://registry:8081 --registry-config schema.registry.basic.auth.user.info=exampleuser:password
namespace Example.Models
{
    public class ExampleModel
    {
        public string Text { get; set; }
    }
}
Generate code from a local schema file (Bash)
$ dotnet avro generate < example-model.avsc > ExampleModel.cs
Generate code from a local schema file (PowerShell)
PS C:\> Get-Content .\example-model.avsc | dotnet avro generate | Out-File .\ExampleModel.cs

Options

-c, --registry-config
Configuration options to provide to the registry client (multiple space-separated key=value pairs accepted).
-r, --registry-url
The URL of the schema registry.
Resolve schema by ID
-i, --id
The ID of the schema.
Resolve schema by subject/version
-s, --subject
The subject of the schema.
-v, --version
The version of the schema.
Chr.Avro