feat: increase question content length/#701#702
Conversation
There was a problem hiding this comment.
Code Review
This pull request increases the character limit for the question content field from 1000 to 2000 characters, updating the database migration, JPA entity, DTOs, and Swagger documentation, while adding corresponding validation tests. The review feedback recommends consistently increasing the length of the explanation field as well, suggesting updates to the JPA entity, DTO validation, and the SQL migration script to prevent potential data truncation or validation errors.
| @Column(nullable = false, length = 2000) | ||
| private String content; | ||
|
|
||
| private String explanation; |
There was a problem hiding this comment.
질문 내용(content)의 최대 길이를 2000자로 늘린 것과 대조적으로, 해설(explanation) 필드는 별도의 길이 설정이 없어 기본값인 255자로 제한될 가능성이 큽니다. 질문 내용이 길어지면 그에 따른 해설도 길어질 확률이 높으므로, explanation 필드의 길이도 함께 늘리는 것을 권장합니다.
| @Column(nullable = false, length = 2000) | |
| private String content; | |
| private String explanation; | |
| @Column(nullable = false, length = 2000) | |
| private String content; | |
| @Column(length = 2000) | |
| private String explanation; |
| @NotBlank(message = "content는 필수 입력값입니다.") | ||
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | ||
| String content, | ||
|
|
||
| String explanation, |
There was a problem hiding this comment.
DB와 엔티티의 변경 사항에 맞춰 DTO에서도 explanation 필드에 대한 @SiZe 검증을 추가하는 것이 안전합니다. 검증이 없으면 DB 저장 시점에 예외가 발생할 수 있습니다.
| @NotBlank(message = "content는 필수 입력값입니다.") | |
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | |
| String content, | |
| String explanation, | |
| @NotBlank(message = "content는 필수 입력값입니다.") | |
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | |
| String content, | |
| @Size(max = 2000, message = "explanation은 최대 2000자까지 입력할 수 있습니다.") | |
| String explanation, |
| @NotBlank(message = "content는 필수 입력값입니다.") | ||
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | ||
| String content, | ||
|
|
||
| String explanation, |
There was a problem hiding this comment.
수정 DTO에서도 explanation 필드에 대한 최대 길이 검증을 추가하여 런타임 에러를 방지하는 것이 좋습니다.
| @NotBlank(message = "content는 필수 입력값입니다.") | |
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | |
| String content, | |
| String explanation, | |
| @NotBlank(message = "content는 필수 입력값입니다.") | |
| @Size(max = 2000, message = "content는 최대 2000자까지 입력할 수 있습니다.") | |
| String content, | |
| @Size(max = 2000, message = "explanation은 최대 2000자까지 입력할 수 있습니다.") | |
| String explanation, |
| ALTER TABLE questions_v2 | ||
| ALTER COLUMN content TYPE VARCHAR(2000); No newline at end of file |
변경사항
관련 이슈
Closes #701
추가 컨텍스트