@newskit-render/validation
TypeScript icon, indicating that this package has built-in type declarations

1.18.1 • Public • Published

@newskit-render/validation

A package for adding validation to my account.

How to use:

import initializeYupSchema, { OverrideYupSchemaType, ValidationFieldNames, } from '@newskit-render/validation'

import \* as yup from 'yup'

/_ Example of name validation override _/

const nameValidation = yup.object().shape({
  firstName: yup.string().required('First Name is required overriden'),
  lastName: yup.string().required('Last Name is required overriden'),
})

/_ Example of required fields override _/

const requiredFieldsOverride = [
  ValidationFieldNames.firstName,
  ValidationFieldNames.line1,
  ValidationFieldNames.mobile,
]

/_ Pass your override schema to here, so it's delegated accordingly _/

const overrideYupSchema: OverrideYupSchemaType = {
  name: nameValidation,
  options: {
    overrideRequiredFields: requiredFieldsOverride
  }
}

export default initializeYupSchema({overrideYupSchema})

Initializing Options

You can pass message templates, that will be used as the template of the required messages and wrong format messages.

export default initializeYupSchema({
  overrideYupSchema: overrideYupSchema,
  options: {
    requiredMessage: "Please enter your ${field}",
    wrongFormatMessage : '${field} is wrong format'
  }
})

Yup testing documentation .

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.18.1-alpha.00alpha
1.18.1107latest
0.0.0-fc23d3ba41unstable

Version History

VersionDownloads (Last 7 Days)Published
0.0.0-fc23d3ba41
0.0.0-0d361a26c1
0.0.0-800a29f980
1.18.1107
1.18.1-alpha.00
0.0.0-13f98ebc00
0.0.0-e320354190
0.0.0-98b8c88d80
1.18.071
1.18.0-alpha.00
0.0.0-84baf4c1e0
0.0.0-7aee3c8840
1.17.20
1.17.2-alpha.00
0.0.0-8b1c9a58f0
0.0.0-6b630b3db0
0.0.0-5bd1b2b120
0.0.0-f90a1dfc40
0.0.0-cffdc2dcc0
0.0.0-b7fba40c60
0.0.0-e67c7c420
0.0.0-014af0810
1.17.10
1.17.1-alpha.00
1.17.00
1.17.0-alpha.01
1.16.10
1.16.1-alpha.00
1.16.0-alpha.10
1.16.0-alpha.00
1.15.00
1.15.0-alpha.00
1.14.00
1.14.0-alpha.10
1.14.0-alpha.00
1.13.00
1.13.0-alpha.00
1.12.20
1.12.2-alpha.11
1.12.2-alpha.00
1.12.10
1.12.1-alpha.00
1.12.00
1.12.0-alpha.00
1.11.1-alpha.00
1.11.00
1.11.0-alpha.10
1.11.0-alpha.00
1.10.20
1.10.2-alpha.00
1.10.10
1.10.1-alpha.00
1.10.00
1.10.0-alpha.00
1.9.01
1.9.0-alpha.00
1.8.10
1.8.1-alpha.00
1.8.00
1.8.0-alpha.00
1.7.1-alpha.10
1.7.1-alpha.00
1.7.00
1.7.0-alpha.00
1.6.10
1.6.1-alpha.00
1.6.00
1.6.0-alpha.00
1.5.120
1.5.12-alpha.00
1.5.110
1.5.11-alpha.00
1.5.100
1.5.10-alpha.00
1.5.9-alpha.20
1.5.9-alpha.10
1.5.9-alpha.00
1.5.80
1.5.8-alpha.00
1.5.70
1.5.7-alpha.00
1.5.60
1.5.6-alpha.00
1.5.50
1.5.5-alpha.00
1.5.40
1.5.4-alpha.00
1.5.30
1.5.3-alpha.00
1.5.20
1.5.2-alpha.00
1.5.10
1.5.1-alpha.00
1.5.00
1.5.0-alpha.00
1.4.00
1.4.0-alpha.00
1.3.20
1.3.2-alpha.00
1.3.10
1.3.1-alpha.00
1.3.00
1.3.0-alpha.00
1.2.10
1.2.1-alpha.00
1.2.00
1.2.0-alpha.00
1.1.00
1.1.0-alpha.00
1.0.00
1.0.0-alpha.30
1.0.0-alpha.20
1.0.0-alpha.10
1.0.0-alpha.00
0.55.00
0.55.0-alpha.20
0.55.0-alpha.10
0.55.0-alpha.00
0.54.10
0.54.1-alpha.00
0.54.00
0.54.0-alpha.00
0.53.00
0.53.0-alpha.00
0.52.10
0.52.1-alpha.10
0.52.1-alpha.00
0.52.00
0.52.0-alpha.00
0.51.10
0.51.1-alpha.00
0.51.00
0.51.0-alpha.00
0.50.00
0.50.0-alpha.00
0.49.00
0.49.0-alpha.10
0.49.0-alpha.00
0.48.00
0.48.0-alpha.00
0.47.00
0.47.0-alpha.00
0.46.00
0.46.0-alpha.10
0.45.0-alpha.10
0.45.0-alpha.00
0.44.00
0.43.0-alpha.00
0.42.00
0.41.10
0.41.00
0.40.00
0.39.20
0.39.10
0.39.00
0.38.00
0.37.00
0.36.00
0.35.00
0.34.30
0.34.20
0.34.10
0.34.00
0.33.00
0.32.00
0.31.10
0.31.00
0.30.00
0.29.00
0.28.00
0.27.00
0.26.20
0.26.10
0.26.00
0.25.00
0.24.10
0.24.00
0.23.00
0.22.20
0.22.10
0.22.00
0.21.00
0.20.00
0.19.10
0.19.00
0.18.10
0.18.00
0.17.30
0.17.20
0.17.10
0.17.00
0.16.10
0.16.00
0.15.00
0.14.30
0.14.20
0.14.10
0.14.00
0.13.00
0.12.00
0.11.00
0.10.00
0.9.00
0.8.00
0.7.30
0.7.20
0.7.10
0.7.00
0.6.00
0.5.20
0.5.10
0.5.00
0.4.00
0.3.00
0.2.00
0.1.00
0.0.30

Package Sidebar

Install

npm i @newskit-render/validation

Weekly Downloads

183

Version

1.18.1

License

UNLICENSED

Unpacked Size

214 kB

Total Files

86

Last publish

Collaborators

  • newskit