ueb-validate
v0.0.26
Published
The original idea behind this package was handling front and back end validation in one centralized location. We also wanted to improve frontend validation by giving the user specific error messages to help them understand why what they are trying to save
Downloads
6
Readme
ueb-validate
The original idea behind this package was handling front and back end validation in one centralized location. We also wanted to improve frontend validation by giving the user specific error messages to help them understand why what they are trying to save is invalid.
As of this update 9/9/19, this package is only being used in the frontend with the improved validation error messages.
Getting Started
Prerequisites
Node should be at least version 8.11
Installing
To install this package into your node
project, simply run this command inside your project's folder:
npm i ueb-validate
Running the tests
Run npm test
to run tests.
Deployment
To use this package, import whichever card data validator that you interested like this:
import cardValidator from "./ueb-validate/card-validate.js";
Then use this validator by calling it on a card. Take a look at /ueb-validate/src/card-validate.test.js
to see how this works.
Development
Modifying or adding a new card-subschema
The javascript functions only act as a medium between the JSON schema validation and the error output. If you want to change or add a schema follow these steps:
- Clone the repo,
cd ueb-validate
, then create and checkout a new branch to work on your new schema in - Run
npm i
to install the dependencies - Think about what the required fields should be for your new card body type
- Implement the required fields as a schema based on the JSON schema specification
- Add your sweet new schema into the folder:
ueb-validate/src/schemas/
- Then add your new schema to the:
ueb-validate/src/CardSubSchemas.js
card sub schema map - Add tests to show how your new schema works to the file:
ueb-validate/src/card-subschema-validate.js
- Once you're happy with your new schema and tests merge your branch with the
master
Compiling and publishing the package to npm
- In the
master
branch runnpm version <type>
where<type>
is eitherpatch
,minor
ormajor
- Commit and push the version change to GitHub
- Push the new version tag to GitHub with:
git push --tags
- Compile the package with babel by running the predefined npm script:
npm run prepare
- Run
npm publish
to publish this new version to NPM package
README.md Updates
| Update | Date | | ----------- | ----------- | | Original | 1/4/19 | | First | 9/9/19 |