@cypress/schema-tools

Validate, sanitize and document JSON schemas
Motivation
Explicit JSON schemas describing objects passed in your system are good.
- they are a living testable documentation instead of manual Wiki editing
- provide examples for tests and integrations
- validate inputs and outputs of the API calls
API
TODO describe current API
documentSchemas
You can document your schemas using provided method. Example code file
import { documentSchemas } from '@cypress/schema-tools'
import { schemas } from './schemas'
import { formats } from './formats'
console.log(documentSchemas(schemas, formats))
Call it from your NPM scripts
{
"scripts": {
"document": "ts-node ./document.ts > schemas.md"
},
"devDependencies": {
"ts-node": "5.0.1",
"typescript": "2.8.1"
}
}
Testing
Uses ava-ts to run Ava test runner directly against TypeScript test files. Use npm t
to build and test everything in the test
folder.
To run a single test file, use command
npx ava-ts test/<file-name.ts>
To update snapshots and use verbose reporter (prints test names)
npx ava-ts test/<file-name.ts> --verbose -u
License
This project is licensed under the terms of the MIT license.