Skip to content

v0.7.0

Latest

Choose a tag to compare

@github-actions github-actions released this 12 Aug 07:42
· 3 commits to main since this release
26965ff

Minor Changes

  • #108 5696c4c Thanks @kimjbstar! - Add makeDtoFiles, which generates Create<Model> and Update<Model> classes alongside each
    model class. They're compositions rather than copies — CreateUser extends OmitType(User, [...] as const) and UpdateUser 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/swagger when useSwagger is on, @nestjs/mapped-types otherwise.

    A field leaves the Create DTO 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 @id without a default all stay — nothing is inferred from field names. Off by
    default, so existing output is unchanged.

Patch Changes

  • #106 5be2cb0 Thanks @kimjbstar! - Fix useNonNullableAssertions producing TypeScript that doesn't compile. A field with a literal
    @default(...) was emitted as views!: 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, and useUndefinedDefault hit the
    same thing. The assertion is now omitted whenever the field has an initializer, which is what
    definite assignment already means.