Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to apply a transform function on fluent-json-schema #1034

Open
bacloud22 opened this issue Jun 25, 2024 · 0 comments
Open

How to apply a transform function on fluent-json-schema #1034

bacloud22 opened this issue Jun 25, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@bacloud22
Copy link

Hi,
fluent-json-schema is used for validation, but I want to add a transformer (trim in my case), that I'm thinking it can go hand in hand with validaiton.

For reference, I looked for answers, and this relates: https://stackoverflow.com/a/63305773

But I'm using fluent-json-schema specifically:

// example: How to trim string values here?

import S from 'fluent-json-schema'

export const signupSchema = S.object()
    .prop('unique_tab_id', S.string().minLength(36).maxLength(36))
    .prop('username', S.string().format(S.FORMATS.EMAIL))
    .prop('password', S.string().minLength(4).maxLength(40))
    .prop('firstName', S.string().minLength(2).maxLength(40))
    .prop('secondName', S.string().minLength(2).maxLength(40))
    .required(['username', 'password', 'firstName', 'secondName'])

If this is not possible, do you think it is useful to add some transform function for fluent-json-schema as an option ?

Kindly

@bacloud22 bacloud22 added the help wanted Extra attention is needed label Jun 25, 2024
@dosubot dosubot bot added the enhancement New feature or request label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant