Skip to content

Improve and add more SSN related Zod schemas - #160

Open
ahinkka wants to merge 26 commits into
mainfrom
feature/ssn-schemas-with-input-trimming
Open

ahinkka wants to merge 26 commits into
mainfrom
feature/ssn-schemas-with-input-trimming

Conversation

@ahinkka

@ahinkka ahinkka commented Oct 8, 2026

Copy link
Copy Markdown

There's currently quite a few places where SSN inputs have spaces in them. There's no reason for not properly normalizing them in one place.

References:

ahinkka and others added 2 commits October 8, 2026 11:57
There's currently quite a few places where SSN inputs have spaces in
them. There's no reason for not properly normalizing them in one place.
`message` property is deprecated in favour of `error`
@adetabs
adetabs force-pushed the feature/ssn-schemas-with-input-trimming branch from ca509e8 to 9fe925b Compare October 8, 2026 13:15
@adetabs
adetabs force-pushed the feature/ssn-schemas-with-input-trimming branch from b116531 to 08fd17a Compare October 8, 2026 13:29
@adetabs
adetabs force-pushed the feature/ssn-schemas-with-input-trimming branch from 01ebe59 to 3a607a2 Compare October 8, 2026 14:03
@adetabs
adetabs force-pushed the feature/ssn-schemas-with-input-trimming branch from 3a607a2 to 5799883 Compare October 8, 2026 14:04
@adetabs
adetabs force-pushed the feature/ssn-schemas-with-input-trimming branch from ba859bf to 4a0e0f5 Compare October 9, 2026 09:29
Comment thread packages/validation/src/index.ts Outdated
Comment thread packages/validation/src/index.ts Outdated
Comment thread packages/validation/src/index.ts
Comment thread packages/validation/src/index.ts Outdated
adetabs and others added 2 commits October 13, 2026 15:18
Co-authored-by: Atte Hinkka <306564+ahinkka@users.noreply.github.com>
Comment thread packages/validation/src/index.ts Outdated
Comment thread packages/validation/src/index.ts Outdated
Comment thread packages/user-management/src/user-types.ts
const matched = ssn
.trim()
.match(/^([0-9]{6})([-+]|[A-F]|[a-f]|[Yy]|[Xx]|[Ww]|[Vv]|[Uu])([\d]{3}|U[\d]{2})([\dA-Ya-y])$/)
.match(/^([0-9]{6})([-+]|[A-F]|[a-f]|[Yy]|[Xx]|[Ww]|[Vv]|[Uu])([\d]{3}|[Uu][\d]{2})([\dA-Ya-y])$/)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tulisiko selkeempi regex jos laittaisi .toUppercase() ennen regexiä, sotkisiko jotain myöhemmin

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tätä isSsnValid-funktiota käytetään meidän repoissa myös suoraan ilman tota zod-skeemaa, niin se vaatisi sitten että kaikkialla missä tätä kutsutaan tehtäis kapitalisaatio. Se ei toisaalta oo pakolla huono asia. Mitä mieltä?

const fakeYtlSsnRegEx = /\d{6}(AU|-U)\d{2}\w$/
const fakeYtlSsnRegEx = /^([0-9]{6})([-+]|[A-F]|[a-f]|[Yy]|[Xx]|[Ww]|[Vv]|[Uu])[Uu][\d]{2}([\dA-Ya-y])$/

return fakeYtlSsnRegEx.test(ssn)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sama toUpperCase täällä

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants