Skip to content

Commit

Permalink
feat(schema): add support for keyword deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Dec 16, 2019
1 parent 72a0fde commit 934b856
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/formatInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,18 @@ function parsedescription(str) {
};
}

function getstatus(schema) {
if (schema[keyword`deprecated`] === true) {
return 'deprecated';
}
return schema[keyword`meta:status`] || undefined;
}

function formatmeta(schema) {
return {
abstract: isabstract(schema),
extensible: isextensible(schema),
status: schema[keyword`meta:status`] || undefined,
status: getstatus(schema),
identifiable: isidentifiable(schema),
custom: iscustom(schema),
additional: schema[keyword`additionalProperties`] !== false,
Expand Down
6 changes: 3 additions & 3 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 74%
This report lists the keywords of the JSON Schema spec that are covered in the tests. The overall coverage is 76%

## The JSON Schema Core Vocabulary

Expand Down Expand Up @@ -135,12 +135,12 @@ Coverage for [A Vocabulary for the Contents of String-Encoded Data](https://json

## A Vocabulary for Basic Meta-Data Annotations

Coverage for [A Vocabulary for Basic Meta-Data Annotations](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9) is 57%.
Coverage for [A Vocabulary for Basic Meta-Data Annotations](https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9) is 71%.

| Keyword | Supported |
| :------------ | --------- |
| `default` | Yes |
| `deprecated` | No |
| `deprecated` | Yes |
| `description` | Yes |
| `examples` | Yes |
| `readOnly` | No |
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/readme-1/simple.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "https://example.com/schemas/simple",
"title": "Simple",
"deprecated": true,
"description": "This is a *very* simple example of a JSON schema. There is only one property.",
"type": "object",
"properties": {
Expand Down
1 change: 1 addition & 0 deletions test/markdownBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ Reference this group by using

it('Simple Schema looks OK', () => {
assertMarkdown(results.simple)
.contains('Deprecated')
.contains('"Simply Untitled"')
.contains('# Simple Schema');
});
Expand Down

0 comments on commit 934b856

Please sign in to comment.