Skip to content
This repository was archived by the owner on Jun 12, 2026. It is now read-only.

Commit 126c1cb

Browse files
author
antialias
committed
no longer exporting validator. using jest for tests
1 parent 791c85e commit 126c1cb

46 files changed

Lines changed: 862 additions & 1679 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,32 @@ Standard, Specification, Schema
2929
* 2014-07-12 - `email` and `phone` were changed from objects into strings - [Discussion](https://github.com/jsonresume/resume-schema/issues/27) - [Commit](https://github.com/jsonresume/resume-schema/pull/98)
3030
* 2014-07-12 - `firstName` and `lastName` were merged into `name` - [Discussion](https://github.com/jsonresume/resume-schema/issues/4) - [Commit](https://github.com/jsonresume/resume-schema/commit/717b2a525f4f42e9994c54bfa3cdbe0cea5776a6)
3131

32-
### Gitter
32+
### Community Chat
3333

34-
Everyone working on the early stages of the project should join our gitter channel [gitter.im/jsonresume/public](https://gitter.im/jsonresume/public).
34+
* [Gitter](https://gitter.im/jsonresume/public)
3535

36-
### Getting started
36+
### Installation
3737

38+
Resume-schema is intended to be installed as a dependency of your project:
39+
40+
```sh
41+
npm add resume-schema
3842
```
39-
npm install --save resume-schema
40-
```
4143

42-
To use
44+
### Usage
45+
The main export of this package is an object that validates as a [JSON schema](https://json-schema.org/understanding-json-schema/). It should work with [any compliant implementation](https://json-schema.org/implementations.html#validator-javascript).
46+
47+
#### validation
48+
To determine if an object is a valid JSON resume, you can do something like this:
4349

4450
```js
45-
var resumeSchema = require('resume-schema');
46-
resumeSchema.validate({ name: "Thomas" }, function (err, report) {
47-
if (err) {
48-
console.error('The resume was invalid:', err);
49-
return;
50-
}
51-
console.log('Resume validated successfully:', report);
52-
});
53-
```
51+
import schema from 'resume-schema';
52+
import Ajv from 'ajv'; // validator. See https://ajv.js.org/
5453

55-
More likely
54+
const validate = new Ajv().compile(schema);
5655

57-
```js
58-
var fs = require('fs');
59-
var resumeSchema = require('resume-schema');
60-
var resumeObject = JSON.parse(fs.readFileSync('resume.json', 'utf8'));
61-
resumeSchema.validate(resumeObject);
56+
validate({basics: {name: "Thomas"}}); // true
57+
validate({invalidProperty: "foo bar"}); // false
6258
```
6359

6460
The JSON Resume schema is available from:
@@ -73,7 +69,7 @@ require('resume-schema').schema;
7369

7470
### Contribute
7571

76-
We encourage anyone who's interested in participating in the formation of this standard, to join us on Gitter, and/or to join the discussions [here on GitHub](https://github.com/jsonresume/resume-schema/issues). Also feel free to fork this project and submit new ideas to add to the JSON Resume Schema standard. To make sure all formatting is kept in check, please install the [EditorConfig plugin](http://editorconfig.org/) for your editor of choice.
72+
We encourage anyone who's interested in participating in evolving this standard to join us on Gitter, and/or to join the discussions [here on GitHub](https://github.com/jsonresume/resume-schema/issues). Also feel free to fork this project and submit new ideas to add to the JSON Resume Schema standard. To make sure all formatting is kept in check, please install the [EditorConfig plugin](http://editorconfig.org/) for your editor of choice.
7773

7874
### Versioning
7975

0 commit comments

Comments
 (0)