Skip to content

Commit

Permalink
feat: add support for tags field on Server Model
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya committed Jun 17, 2022
1 parent c8b5c37 commit 0962333
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 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);
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 0962333

Please sign in to comment.