@dvsa/cvs-type-definitions v9.1.0
cvs-type-definitions
json schema and .ts type definitions for cvs vta application
Usage
Install GitHub package:
- Ensure consuming repo is set up to install private DVSA packages by adding the following to the
.npmrcfile:@dvsa:registry=https://npm.pkg.github.com - NOTE: in order to install private DVSA packages you will need a
.npmrcfile in your$PATHcontaining a personal access token linked to the DVSA org. You should add the token to your.npmrcfile as follows://npm.pkg.github.com/:_authToken=<AUTH_TOKEN_HERE>
- install GitHub package:
npm install @dvsa/cvs-type-definitions@latest
Example usage (TS types):
import { CommercialVehicleTestSchema } from @dvsa/cvs-type-definitions/types/test
Example usage (json schemas)
The package exports an isValidObject() function which can be used to validate an object against a specified schema. E.g:
import { isValidObject } from '@dvsa/cvs-type-definitions/lib/src/schema-validation/schema-validator';
const isValidVisit: boolean = isValidObject('visit', myVisitObject);
Updating a schema
Edits should only be made to json schema definitions within json-definitions directory.
TypeScript interfaces will be generated from these files and saved to types directory. De-referenced json schema definitions will be saved to json-schemas directory. Only these two directories are published in the npm package.
- Navigate into the relevant schema (e.g.
./json-definitions/test/index.json) - Edit file
- Generate the new TypeScript and de-referenced json schema definitions using
npm run generate - Bump the version of the package using
npm version {major|minor|patch} - Publish updates
Adding a new schema
- Create a new subdirectory with an appropriate name within the
json-defininitionsdirectory (e.g.my-new-schema) - Add an
index.jsonfile to the new directory with appropriate json schema definitions - Add the new schema name to the
schemasconstant array in./schemas.tsNOTE: this MUST match the directory name created at step 1 (my-new-schemain the example here) - Generate the new TypeScript definitions using
npm run generate - Bump the version of the package using
npm version {major|minor|patch} - Publish updates
Publishing github package
- Raise a Pull Request on Github and await approvals
- Once merged, publish the new package from the latest
developbranch to GitHub packages usingnpm publish- _You must be logged in and have the correct permissions to publish to the package
1 year ago
7 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
7 months ago
9 months ago
1 year ago
1 year ago
1 year ago
6 months ago
9 months ago
1 year ago
1 year ago
9 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago