Table of Contents

Class DtoBuilder

Namespace
TypedRest.CodeGeneration.TypeScript.Dtos
Assembly
TypedRest.CodeGeneration.TypeScript.dll

Builds the TypeScript type for a single schema.

public abstract class DtoBuilder
Inheritance
object
DtoBuilder
Derived

Constructors

DtoBuilder(string, OpenApiSchema, INamingStrategy, TypeNameRegistry?)

Builds the TypeScript type for a single schema.

protected DtoBuilder(string key, OpenApiSchema schema, INamingStrategy naming, TypeNameRegistry? typeNames = null)

Parameters

key string

The key identifying the schema.

schema OpenApiSchema

The schema to generate a type for.

naming INamingStrategy

Decides what the generated type is called.

typeNames TypeNameRegistry

Keeps the names of types generated for inline schemas from colliding with other generated types.

Fields

ChildTypes

Types generated for schemas inlined in Schema.

protected readonly List<ITsType> ChildTypes

Field Value

List<ITsType>

Identifier

The name and module of the generated type.

protected readonly TsIdentifier Identifier

Field Value

TsIdentifier

Naming

Decides what the generated type is called.

protected readonly INamingStrategy Naming

Field Value

INamingStrategy

Schema

The schema to generate a type for.

protected readonly OpenApiSchema Schema

Field Value

OpenApiSchema

TypeNames

Keeps the names of types generated for inline schemas from colliding with other generated types.

protected readonly TypeNameRegistry? TypeNames

Field Value

TypeNameRegistry

Methods

BuildTypeInner()

Builds the type for Schema, without the parts common to all kinds of DTO.

protected abstract ITsType BuildTypeInner()

Returns

ITsType

BuildTypes()

Builds the type for Schema, followed by the types for any schemas inlined in it.

public IEnumerable<ITsType> BuildTypes()

Returns

IEnumerable<ITsType>

For(string, OpenApiSchema, INamingStrategy, TypeNameRegistry?)

Returns a builder suitable for schema, or null if it needs no type of its own.

public static DtoBuilder? For(string key, OpenApiSchema schema, INamingStrategy naming, TypeNameRegistry? typeNames = null)

Parameters

key string
schema OpenApiSchema
naming INamingStrategy
typeNames TypeNameRegistry

Returns

DtoBuilder