The Product model is the central domain object in this API. It represents a single item in the product catalog and appears in three distinct shapes depending on context: the internalDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ricpalomino/spring-boot/llms.txt
Use this file to discover all available pages before exploring further.
Product entity used by the service and repository layers, the ProductRequestDTO accepted in POST and PUT request bodies, and the ProductResponseDTO returned in every API response. Understanding the difference between these shapes helps you construct valid requests and correctly parse the responses you receive.
The
Product entity is an internal class never exposed directly over the wire. You send ProductRequestDTO when creating or updating a product, and you always receive ProductResponseDTO inside an ApiResponse<T> envelope. See the ApiResponse envelope page for details on the wrapper.Product entity (internal)
Product is the internal domain object used by the service and repository layers. It is never serialized directly into an HTTP response.
Auto-assigned unique identifier for the product. Set by the repository when a product is persisted.
Human-readable name of the product.
Price of the product as a floating-point number.
ProductRequestDTO
UseProductRequestDTO as the JSON body when calling POST /api/v1/products to create a product or PUT /api/v1/products/{id} to update one. Both fields are required and validated on arrival.
Product name. Must be between 3 and 100 characters and must not be blank. Validation error:
"El nombre del producto debe tener entre 3 y 100 caracteres".Product price. Must be at least
1. Validation error: "El precio del producto debe ser mayor a 0".Validation constraints
| Field | Constraint | Rule | Error message |
|---|---|---|---|
name | @NotBlank | Must not be null or empty | "Nombre del proudcto es requerido" |
name | @Size(min=3, max=100) | Between 3 and 100 characters | "El nombre del producto debe tener entre 3 y 100 caracteres" |
price | @Min(1) | Numeric value ≥ 1 | "El precio del producto debe ser mayor a 0" |
400 response. The data field of the envelope contains a map of field names to their corresponding error messages. See the ApiResponse envelope page for an example.
ProductResponseDTO
ProductResponseDTO is the shape you receive in the data field of every successful product response. It mirrors the Product entity but is decoupled from it so that internal implementation details are never leaked to consumers.
Auto-assigned unique identifier for the product.
Name of the product.
Price of the product.
Source code
JSON examples
Request body
Send this JSON when creating or updating a product.Request body
Response object
Thedata field of a successful response contains a ProductResponseDTO.
Response object