Skip to content

Commit

Permalink
fix: Add support for missing 'deprecated' attribute (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrowley authored Apr 28, 2020
1 parent 71d5995 commit bd96a2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/models/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ class Schema extends Base {
return this._json.default;
}

/**
* @returns {boolean}
*/
deprecated() {
return this._json.deprecated;
}

/**
* @returns {boolean}
*/
Expand Down
9 changes: 9 additions & 0 deletions test/models/schema_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,15 @@ describe('Schema', () => {
});
});

describe('#deprecated()', function () {
it('should return a boolean', () => {
const doc = { "type": "string", "deprecated": true };
const d = new Schema(doc);
expect(typeof d.deprecated()).to.be.equal('boolean');
expect(d.deprecated()).to.be.equal(doc.deprecated);
});
});

describe('#readOnly()', function () {
it('should return a boolean', () => {
const doc = { "type": "string", "readOnly": true };
Expand Down

0 comments on commit bd96a2a

Please sign in to comment.