Table of Contents

Method Generate

Namespace
AvroSharp.CodeGen
Assembly
AvroSharp.CodeGen.dll

Generate(IEnumerable<AvroSchema>, CodeGenOptions?)

Generates one source file per named type reachable from schemas.

public static IReadOnlyList<GeneratedSource> Generate(IEnumerable<AvroSchema> schemas, CodeGenOptions? options = null)

Parameters

schemas IEnumerable<AvroSchema>

The schemas. A named type reachable from several of them is generated once.

options CodeGenOptions

Options, or null for Default.

Returns

IReadOnlyList<GeneratedSource>

Generate(IEnumerable<AvroSchema>, CodeGenOptions?, Func<NamedSchema, CodeGenOptions?>?)

Generates one source file per named type reachable from schemas, each with its own options: for example those of the file that defines it (the source generator's AdditionalFiles metadata, #18).

public static IReadOnlyList<GeneratedSource> Generate(IEnumerable<AvroSchema> schemas, CodeGenOptions? options, Func<NamedSchema, CodeGenOptions?>? typeOptions)

Parameters

schemas IEnumerable<AvroSchema>

The schemas. A named type reachable from several of them is generated once.

options CodeGenOptions

The options of types typeOptions gives none for, or null for Default.

typeOptions Func<NamedSchema, CodeGenOptions>

A named type's own options, or null for options. They may differ in Namespace, LogicalTypes, ApacheCompatible, PropertyNames, RequiredMembers, TypeKind, Accessibility, SealedTypes and CollectionType; the others (LanguageVersion, NullableAnnotations, TargetHasDateOnly and NamespaceMap) are the project's and must be options'.

Returns

IReadOnlyList<GeneratedSource>

Exceptions

ArgumentException

Options are invalid, or a type's differ from options in a project-wide setting.