Skip to content

Commit

Permalink
feat: add support for tags field on Server model (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Sep 22, 2022
1 parent 354ce27 commit b9e5401
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion lib/models/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ServerSecurityRequirement = require('./server-security-requirement');
const MixinDescription = require('../mixins/description');
const MixinBindings = require('../mixins/bindings');
const MixinSpecificationExtensions = require('../mixins/specification-extensions');
const MixinTags = require('../mixins/tags');

/**
* Implements functions to deal with a Server object.
Expand All @@ -16,6 +17,7 @@ const MixinSpecificationExtensions = require('../mixins/specification-extensions
* @mixes MixinDescription
* @mixes MixinBindings
* @mixes MixinSpecificationExtensions
* @mixes MixinTags
* @returns {Server}
*/
class Server extends Base {
Expand Down Expand Up @@ -71,4 +73,4 @@ class Server extends Base {
}
}

module.exports = mix(Server, MixinDescription, MixinBindings, MixinSpecificationExtensions);
module.exports = mix(Server, MixinDescription, MixinBindings, MixinSpecificationExtensions, MixinTags);
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^9.0.6",
"@asyncapi/specs": "^3.0.0",
"@asyncapi/specs": "2.15.0-next-spec.2",
"@fmvilas/pseudo-yaml-ast": "^0.3.1",
"ajv": "^6.10.1",
"js-yaml": "^3.13.1",
Expand Down
4 changes: 3 additions & 1 deletion test/models/server_test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const { expect } = require('chai');
const js = { url: 'test.com', protocol: 'amqp', protocolVersion: '0-9-1', description: 'test', variables: { test1: { enum: ['value1', 'value2'], default: 'value1', description: 'test1', examples: ['value2'] } }, security: [{ oauth2: ['user:read'] }], bindings: { amqp: 'test' }, 'x-test': 'testing' };
const js = { url: 'test.com', protocol: 'amqp', protocolVersion: '0-9-1', description: 'test', variables: { test1: { enum: ['value1', 'value2'], default: 'value1', description: 'test1', examples: ['value2'] } }, security: [{ oauth2: ['user:read'] }], bindings: { amqp: 'test' }, 'x-test': 'testing', tags: [{ name: 'env:development' }] };

const Server = require('../../lib/models/server');

const { assertMixinDescriptionInheritance } = require('../mixins/description_test');
const { assertMixinBindingsInheritance } = require('../mixins/bindings_test');
const { assertMixinSpecificationExtensionsInheritance } = require('../mixins/specification-extensions_test');
const { assertMixinTagsInheritance } = require('../mixins/tags_test');

describe('Server', function() {
describe('#url()', function() {
Expand Down Expand Up @@ -73,6 +74,7 @@ describe('Server', function() {
assertMixinDescriptionInheritance(Server);
assertMixinBindingsInheritance(Server);
assertMixinSpecificationExtensionsInheritance(Server);
assertMixinTagsInheritance(Server);
});
});
});

0 comments on commit b9e5401

Please sign in to comment.