You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Isbn accepts any EAN-13 barcode: Isbn.Create("4006381333931") (a non-book product code) validates because the 978/979 prefix is never checked #334
That is the EAN-13 check, and every retail barcode passes it. An ISBN-13 is an EAN-13 in the "Bookland" range, which means it must begin with the GS1 prefix 978 or 979. The type's docs say that "registration-group and publisher ranges are not validated". That limitation applies to the groups inside an ISBN. The prefix is what makes a 13-digit code an ISBN in the first place, and it needs no range table.
Reproduction (run against the built assembly, HEAD 4d5ec8d)
Isbn.Create("4006381333931");// accepted: EAN of a retail product, not a bookIsbn.Create("1234567890128");// accepted: arbitrary 12 digits + a valid check digit
Any check-digit-valid 13-digit number is therefore an Isbn. That includes most barcodes a scanner returns, so a type meant to tell a book identifier apart from other strings does not.
Suggested fix / acceptance criteria
In the 13-character branch, require s.StartsWith("978", StringComparison.Ordinal) || s.StartsWith("979", StringComparison.Ordinal) before the checksum.
Update the XML docs on Isbn / IsIsbnAttribute to state the prefix rule.
Tests in Semantics.Test/Identifiers/IsbnTests.cs: 4006381333931 and 1234567890128 throw ArgumentException. 978-0-306-40615-7 still validates, and a valid 979- ISBN (e.g. 979-10-90636-07-1) validates.
Priority: Medium. Isbn accepts any EAN-13 barcode, so the type doesn't tell book identifiers apart from other codes. The fix is a one-line prefix check plus tests. Tightening validation may reject values that callers already store, so mention it in the release notes.
Activity
matt-edmondson commentedon Sep 29, 2026
Triage
Isbnaccepts any EAN-13 barcode, so the type doesn't tell book identifiers apart from other codes. The fix is a one-line prefix check plus tests. Tightening validation may reject values that callers already store, so mention it in the release notes.Semantics.Strings.Identifiers(IsIsbnAttribute)Generated by Claude Code
[patch] Require the 978/979 Bookland prefix on an ISBN-13