This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I, Alexander Osipov, have read and do accept the MuleSoft Contributor Agreement | |
at http://www.mulesoft.org/legal/contributor-agreement.html | |
Accepted on Thu Dec 17 2015 17:54:06 GMT+0600 (Russia TZ 5 Standard Time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('remove all attributes and add #aa81', function () { | |
var api = util.loadApi(util.data('attr/aa8.raml')); | |
var method: hl.IHighLevelNode = <hl.IHighLevelNode>util.xpath(api, "resources[0]/methods[0]"); | |
var attrs = method.attributes('protocols'); | |
console.log("Original:\n" + api.lowLevel().unit().contents()); | |
attrs.forEach(attr => attr.remove()); | |
console.log("After remove:\n" + api.lowLevel().unit().contents()); | |
['HTTP', 'HTTPS', 'HUE'].forEach(val => method.attrOrCreate('protocols').addValue(val)); | |
console.log("After insert:\n" + api.lowLevel().unit().contents()); | |
console.log('attributes count: ' + method.attributes('protocols').length); // 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%RAML 0.8 | |
title: New API | |
version: v1 | |
mediaType: application/json | |
baseUri: http://samplehost.com | |
schemas: | |
- www: !include schemas/www.json | |
- www-xml: !include schemas/www.xml | |
traits: | |
- zzz: |