CrudOptions interface is the primary configuration object used when setting up a CRUD controller with the @Crud() decorator.
Interface Definition
Properties
The entity/model class that the CRUD controller will operate on. This is the only required property.See ModelOptions for details.
Data Transfer Object configurations for create, update, and replace operations.Allows you to specify different DTOs for different operations:
create: DTO class for create operationsupdate: DTO class for update operationsreplace: DTO class for replace operations
Serialization options for transforming entities before returning them in responses.Allows you to specify different serialization classes for each CRUD operation to control which fields are exposed in the API response.
Global query configuration options that apply to all query operations.See QueryOptions for details.
Configuration for individual CRUD routes, allowing you to customize or exclude specific endpoints.See RouteOptions for details.
Custom factory for generating CRUD routes. Advanced use only.This allows you to completely override how routes are generated and registered.
Configuration for URL parameters used in CRUD operations.See ParamsOptions for details.
Validation pipe options from NestJS, or
false to disable validation.When set to false, automatic validation of request bodies and query parameters is disabled. Otherwise, you can pass NestJS ValidationPipeOptions to customize validation behavior.Usage Example
Related Interfaces
ModelOptions
Configure the entity model
QueryOptions
Configure query behavior
RouteOptions
Configure individual routes
ParamsOptions
Configure URL parameters
Notes
The
CrudOptions interface is typically used with the @Crud() decorator to configure your CRUD controller. All properties except model are optional, providing sensible defaults.