@asyncapi/parser
Advanced tools
Comparing version 0.20.0 to 0.21.0
const { addExtensions } = require('../utils'); | ||
const Base = require('./base'); | ||
const ExternalDocs = require('./external-docs'); | ||
@@ -355,2 +356,10 @@ /** | ||
/** | ||
* @returns {ExternalDocs} | ||
*/ | ||
externalDocs() { | ||
if (!this._json.externalDocs) return null; | ||
return new ExternalDocs(this._json.externalDocs); | ||
} | ||
/** | ||
* @returns {boolean} | ||
@@ -357,0 +366,0 @@ */ |
{ | ||
"name": "@asyncapi/parser", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"description": "JavaScript AsyncAPI parser.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -504,2 +504,16 @@ const { expect } = require('chai'); | ||
describe('#externalDocs()', function() { | ||
it('should return null', function() { | ||
const doc = { type: 'string' }; | ||
const d = new Schema(doc); | ||
expect(d.externalDocs()).to.be.equal(null); | ||
}); | ||
it('should return a ExternalDocs object', function() { | ||
const doc = { type: 'string', externalDocs: { description: 'someDescription', url: 'someUrl' } }; | ||
const d = new Schema(doc); | ||
expect(d.externalDocs().constructor.name).to.be.equal('ExternalDocs'); | ||
expect(d.externalDocs().json()).to.be.equal(doc.externalDocs); | ||
}); | ||
}); | ||
describe('#readOnly()', function() { | ||
@@ -506,0 +520,0 @@ it('should return a boolean', function() { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1002982
7643