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
-
objectDtoBuilder
- 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
keystringThe key identifying the schema.
schemaOpenApiSchemaThe schema to generate a type for.
namingINamingStrategyDecides what the generated type is called.
typeNamesTypeNameRegistryKeeps 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
Identifier
The name and module of the generated type.
protected readonly TsIdentifier Identifier
Field Value
Naming
Decides what the generated type is called.
protected readonly INamingStrategy Naming
Field Value
Schema
The schema to generate a type for.
protected readonly OpenApiSchema Schema
Field Value
TypeNames
Keeps the names of types generated for inline schemas from colliding with other generated types.
protected readonly TypeNameRegistry? TypeNames
Field Value
Methods
BuildTypeInner()
Builds the type for Schema, without the parts common to all kinds of DTO.
protected abstract ITsType BuildTypeInner()
Returns
BuildTypes()
Builds the type for Schema, followed by the types for any schemas inlined in it.
public IEnumerable<ITsType> BuildTypes()
Returns
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
keystringschemaOpenApiSchemanamingINamingStrategytypeNamesTypeNameRegistry