Minor Changes
-
#108
5696c4cThanks @kimjbstar! - AddmakeDtoFiles, which generatesCreate<Model>andUpdate<Model>classes alongside each
model class. They're compositions rather than copies —CreateUser extends OmitType(User, [...] as const)andUpdateUser extends PartialType(CreateUser)— so a field's type, Swagger metadata and
validators stay declared in exactly one place, and NestJS's mapped types carry all three through.
Imported from@nestjs/swaggerwhenuseSwaggeris on,@nestjs/mapped-typesotherwise.A field leaves the
CreateDTO only when the schema itself says a client can't supply it: a
function-based@default(...)(autoincrement(),uuid(),now(),dbgenerated(...), …),
@updatedAt, or a relation field. Literal defaults like@default(0), relation foreign-key
scalars, and an@idwithout a default all stay — nothing is inferred from field names. Off by
default, so existing output is unchanged.
Patch Changes
- #106
5be2cb0Thanks @kimjbstar! - FixuseNonNullableAssertionsproducing TypeScript that doesn't compile. A field with a literal
@default(...)was emitted asviews!: number = 0, which is TS1263 — "Declarations with
initializers cannot also have definite assignment assertions". Any model with at least one
defaulted field made the whole generated file fail to build, anduseUndefinedDefaulthit the
same thing. The assertion is now omitted whenever the field has an initializer, which is what
definite assignment already means.