Skip to content

Commit

Permalink
Updated the isbn pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaynegi45 committed Nov 15, 2024
1 parent 14a1587 commit 20d628e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/libraryman_api/book/BookDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public class BookDto {
private String author;

@NotBlank(message = "isbn is required")
@Pattern(regexp = "^(978|979)-\\d{10}$", message = "Invalid ISBN format. Format must be '978-XXXXXXXXXX' or '979-XXXXXXXXXX'")
@Pattern(
regexp = "^(?:\\d{9}[\\dX]|(?:(978|979)-)?\\d{1,5}-\\d{1,7}-\\d{1,7}-\\d{1})$",
message = "Invalid ISBN format. Valid formats include 'XXXXXXXXXX', 'XXXXXXXXXX-X', '978-XXXXXXXXXX', '978-X-XX-XXXXXX-X', etc."
)
private String isbn;


@NotBlank(message = "Publisher is required")
@Size(min = 1, max = 100, message = "Publisher name must be between 1 and 100 characters")
private String publisher;
Expand Down

0 comments on commit 20d628e

Please sign in to comment.