swagger-api / swagger-api/swagger.io-docs

SSN Example regex is not correct

Open
#264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Astro
Stars
1.6k
Forks
407
Avg merge
2m
Merged PRs (30d)
2

Description

SSNs cannot begin with the number 9 (that signifies an ITIN, not an SSN). Also, prefixes like 666 and 333 are also not valid. Meaning the following regex does not truely validate SSNs:
'^\d{3}-\d{2}-\d{4}$'

A more correct regex would be (and supports optional hyphens):
'^(?!000)(?!666)(?!9)\d{3}([- ]?)(?!00)\d{2}\1(?!0000)\d{4}$'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the SSN example that uses the regex shown in issue #264 and inspect its surrounding documentation. Verify the documented pattern against the stated SSN restrictions and optional separator behavior; the work is done when the example accurately describes and validates the intended SSN format.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.