Skip to content

Add Issn (identifiers) #19

@vhrcgcom

Description

@vhrcgcom

Description

Implement Issn as a ValueObject in the identifiers module.

Spec: ISSN with check digit

Implementation checklist

  • Create src/identifiers/issn.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/identifiers/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

Implementation detail

Input / Output

Type Alias
Input String IssnInput
Output String IssnOutput

Normalization

Strip spaces and hyphens; keep only digits and a possible trailing X. Format the output as XXXX-XXXX (with the hyphen reinserted after the 4th character).

Validation

  • Exactly 8 characters after stripping (7 digits + check character which is 0–9 or X).
  • Check character validated using ISSN weighted sum: multiply each of the first 7 digits by weights 8 down to 2, sum them, check character makes the total mod 11 == 0 (X represents 10).

Extra methods

None beyond the trait. value() returns the formatted XXXX-XXXX string.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions