feat: ISBN-10 and ISBN-13 validation (IGO-10)#100
Merged
strider2038 merged 1 commit intoApr 7, 2026
Conversation
- validate.ISBN with ISBNOnly10/ISBNOnly13 and sentinel errors - it.IsISBN with Only10/Only13 and per-mode messages/errors - is.ISBN helper; EN/RU translations; tests and examples Closes IGO-10. Co-authored-by: Igor Lazarev <strider2038@yandex.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds ISBN validation aligned with Symfony
Isbn/IsbnValidator: strip hyphens, ISBN-10 (withXcheck digit) and ISBN-13 checksums, and “any” mode that maps 11–12 digit lengths to a type-not-recognized outcome like Symfony’s combined tests.API
validate.ISBN,validate.ISBNOnly10,validate.ISBNOnly13with sentinel errors (ErrISBNInvalidCharacters,ErrISBNTooShort,ErrISBNTooLong,ErrISBNChecksumFailed,ErrISBNTypeNotRecognized)it.IsISBN()withOnly10()/Only13(), optionalWithISBN10Message,WithISBN13Message,WithBothISBNMessage, and matching error overridesis.ISBNmessage.InvalidISBN,InvalidISBN10,InvalidISBN13(+ EN/RU catalogs),validation.ErrInvalidISBN,ErrInvalidISBN10,ErrInvalidISBN13Testing
validate/isbn_test.go(Symfony test vectors)test/constraints_identifiers_cases_test.goit,validate, andispackagesChangelog
[Unreleased]→ AddedLinear: IGO-10