Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/schema-first-classes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@nestm/standard-schema': minor
---

Replace the DTO-oriented API with schema-first validation, serialization, and OpenAPI integration.

Raw Standard Schemas remain first-class through Nest's native decorator metadata. Applications that want zero-argument `@Body()`, `@Query()`, and `@Param()` reflection can use the new `createSchemaClass` and `createResponseSchemaClass` adapters. The runtime pipe, compiler plugin, examples, diagnostics, and low-level types now use schema-class terminology, and the deprecated Swagger array adapter has been removed.

This is an intentional breaking change with no compatibility aliases. Existing 0.1 alpha releases remain available for applications using the previous DTO API.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

## [Unreleased]

### Changed

- Repositioned the package around schema-first validation, serialization, and OpenAPI integration.
- Replaced the DTO factories and types with `createSchemaClass`, `createResponseSchemaClass`, `SchemaClass`, and `ResponseSchemaClass`.
- Replaced `StandardSchemaDtoValidationPipe` with `SchemaClassValidationPipe` while continuing to delegate parsing to Nest's native Standard Schema components.
- Updated the optional compiler plugin and example to use schema-class terminology and `*.schemas.ts` files.
- Removed the deprecated `withStandardSchemaResponseArrays` adapter now that Nest Swagger 12 handles array shaping natively.

## [0.1.0-alpha.0] - 2026-07-30

### Added
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ After that one-time setup, merge the Changesets release pull request to let GitH

## Design guidelines

- Preserve the native integration boundary: DTO metadata may select a schema, but Nest's native validation pipe and serializer should parse values.
- Preserve the native integration boundary: explicit metadata or a schema class may select a schema, but Nest's native validation pipe and serializer should parse values.
- Keep public APIs compatible with any implementation of Standard Schema.
- Do not add a runtime dependency on Zod for core behavior. Zod can be used in examples and tests.
- Keep request DTOs output-oriented: controller parameters receive `StandardSchemaV1.InferOutput<Schema>`.
- Keep response DTOs input-oriented: handlers return `StandardSchemaV1.InferInput<Schema>`, and clients receive `StandardSchemaV1.InferOutput<Schema>`.
- Use concrete runtime DTO classes where reflection is required. Runtime request discovery cannot recover aliases or interfaces.
- Keep response inference build-time and opt-in. It may unwrap supported `Promise` and array annotations only when the TypeScript compiler plugin has a concrete response-branded DTO.
- Let explicit `@StandardSchemaResponse(...)` or `@SerializeOptions(...)` metadata win. Ambiguous response DTO contracts should fail by default or honor the configured skip behavior.
- Keep request schema classes output-oriented: controller parameters receive `StandardSchemaV1.InferOutput<Schema>`.
- Keep response schema classes input-oriented: handlers return `StandardSchemaV1.InferInput<Schema>`, and clients receive `StandardSchemaV1.InferOutput<Schema>`.
- Treat raw schemas as the primary contract. Use concrete schema classes only where runtime reflection improves ergonomics; runtime discovery cannot recover erased aliases or interfaces.
- Keep response inference build-time and opt-in. It may unwrap supported `Promise` and array annotations only when the TypeScript compiler plugin has a concrete response schema class.
- Let explicit `@StandardSchemaResponse(...)` or `@SerializeOptions(...)` metadata win. Ambiguous response schema-class contracts should fail by default or honor the configured skip behavior.
- Keep the CommonJS compiler entry isolated from the ESM runtime entry. Runtime users should not load TypeScript merely by importing the package.
- Include `.js` suffixes for local imports in TypeScript source compiled as Node ESM.

Expand All @@ -87,7 +87,7 @@ Tests should cover both type-level ergonomics and runtime behavior where applica
- parsed request values reaching the controller;
- coercions, defaults, and transforms;
- response handler input types and serialized client output types;
- `@Body()`, `@Query()`, and `@Param()` DTO discovery;
- `@Body()`, `@Query()`, and `@Param()` schema-class discovery;
- explicit native parameter schemas continuing to work;
- object and array response serialization;
- controller-level and method-level response schemas;
Expand Down
Loading