Table of Contents

Class ClientGenerationOptions

Namespace
TypedRest.CodeGeneration.Generation
Assembly
TypedRest.CodeGeneration.dll

Options controlling the generation of a TypedRest client, common to all target languages.

public class ClientGenerationOptions
Inheritance
object
ClientGenerationOptions
Derived

Remarks

Target languages derive from this to add their own options.

Constructors

ClientGenerationOptions(string)

Creates new generation options.

public ClientGenerationOptions(string serviceName)

Parameters

serviceName string

The service name to use for the entry endpoint.

ClientGenerationOptions(ClientGenerationOptions)

Copies the common options from other.

protected ClientGenerationOptions(ClientGenerationOptions other)

Parameters

other ClientGenerationOptions

Remarks

Used by target languages to accept options that were built without knowledge of the language.

Properties

DtoNamespace

The namespace or module path for the DTOs. Uses Namespace if not set.

public string? DtoNamespace { get; set; }

Property Value

string

GenerateDtos

Controls whether to generate DTOs.

public bool GenerateDtos { get; set; }

Property Value

bool

GenerateEntryConstructor

Controls whether the entry endpoint gets a generated constructor taking the base URI. Turn this off to supply the constructors yourself, e.g. to pass an error handler or custom headers. Not supported by all target languages.

public bool GenerateEntryConstructor { get; set; }

Property Value

bool

GenerateInterfaces

Controls whether to generate interfaces for endpoints. Not supported by all target languages.

public bool GenerateInterfaces { get; set; }

Property Value

bool

Namespace

The namespace or module path for the endpoints. Uses ServiceName if not set.

public string? Namespace { get; set; }

Property Value

string

Serializer

The JSON serializer the generated DTOs are annotated for, or null to use the target language's default.

public string? Serializer { get; set; }

Property Value

string

Remarks

The serializer decides which attributes/annotations carry the wire names of properties, so choosing one that does not match the serializer configured on the endpoint at runtime silently changes the wire format. See SupportedSerializers for the values a target language accepts.

ServiceName

The service name to use for the entry endpoint.

public string ServiceName { get; }

Property Value

string

SupportedSerializers

The names accepted by Serializer, most preferred first. Empty if the target language has no serializer to choose, either because it does not annotate DTOs or because it only supports one.

public virtual IReadOnlyCollection<string> SupportedSerializers { get; }

Property Value

IReadOnlyCollection<string>

Remarks

Target languages override this to declare what they can generate for.