Skip to content

Commit

Permalink
feat(formats): add support for formats: json-pointer, relative-json-p…
Browse files Browse the repository at this point in the history
…ointer, regex, and uri-template
  • Loading branch information
trieloff committed Dec 16, 2019
1 parent 214fdb4 commit 689c158
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
24 changes: 24 additions & 0 deletions lib/markdownBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,30 @@ function build({
specname: 'RFC 4122',
speclink: 'https://tools.ietf.org/html/rfc4122',
},
'json-pointer': {
label: i18n`JSON Pointer`,
text: i18n`the string must be a JSON Pointer, according to `,
specname: 'RFC 6901, section 5',
speclink: 'https://tools.ietf.org/html/rfc6901',
},
'relative-json-pointer': {
label: i18n`Relative JSON Pointer`,
text: i18n`the string must be a relative JSON Pointer, according to `,
specname: 'draft-handrews-relative-json-pointer-01',
speclink: 'https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01',
},
regex: {
label: i18n`RegEx`,
text: i18n`the string must be a regular expression, according to `,
specname: 'ECMA-262',
speclink: 'http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf',
},
'uri-template': {
label: i18n`URI Template`,
text: i18n`the string must be a URI template, according to `,
specname: 'RFC 6570',
speclink: 'https://tools.ietf.org/html/rfc6570',
},
};

const headerprops = [
Expand Down
12 changes: 6 additions & 6 deletions schemasupport.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JSON Schema Spec Coverage Report

This report lists the keywords of the JSON Schema spec that are covered in the tests. The overall coverage is 64%
This report lists the keywords of the JSON Schema spec that are covered in the tests. The overall coverage is 69%

## The JSON Schema Core Vocabulary

Expand Down Expand Up @@ -99,7 +99,7 @@ Coverage for [Validation Keywords for Objects](https://json-schema.org/draft/201

## Defined Formats

Coverage for [Defined Formats](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.3) is 78%.
Coverage for [Defined Formats](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.3) is 100%.

| Keyword | Supported |
| :---------------------- | --------- |
Expand All @@ -114,13 +114,13 @@ Coverage for [Defined Formats](https://json-schema.org/draft/2019-09/json-schema
| `ipv6` | Yes |
| `iri` | Yes |
| `iri-reference` | Yes |
| `json-pointer` | No |
| `regex` | No |
| `relative-json-pointer` | No |
| `json-pointer` | Yes |
| `regex` | Yes |
| `relative-json-pointer` | Yes |
| `time` | Yes |
| `uri` | Yes |
| `uri-reference` | Yes |
| `uri-template` | No |
| `uri-template` | Yes |
| `uuid` | Yes |

## A Vocabulary for the Contents of String-Encoded Data
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/stringformats/simpletypes.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@
"version": "1.0.0",
"testProperty": "test"
},
"string_other": {
"type": "string",
"description": "A URI.",
"format": "unknown",
"version": "1.0.0",
"testProperty": "test"
},
"number_unconstrained": {
"type": "number",
"description": "Just a number",
Expand Down
4 changes: 4 additions & 0 deletions test/zSchemaCoverage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const { report } = require('../lib/keywords');
const expected = [
'examples',
'allOf',
'json-pointer',
'relative-json-pointer',
'regex',
'uri-template',
];

const allkeywords = {
Expand Down

0 comments on commit 689c158

Please sign in to comment.