swagger-api / swagger-api/swagger.io-docs
SSN Example regex is not correct
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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