Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
[ci skip] Automated merge stage->master.
Browse files Browse the repository at this point in the history
  • Loading branch information
arcauto committed Jan 10, 2017
2 parents 9ec635b + 91b59fc commit 50e6d68
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"esnext": true,
"esnext": false,
"node": true,
"browser": true,
"bitwise": false,
Expand All @@ -14,9 +14,8 @@
"undef": true,
"unused": true,
"newcap": false,
"mocha": true,
"globals": {
"Polymer": true,
"fetch": true,
"Headers": true
"Polymer": true
}
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="0.1.7"></a>
## [0.1.7](https://github.com/advanced-rest-client/raml-docs-method-viewer/compare/0.1.6...v0.1.7) (2017-01-10)


### Update

* Added test cases ([02221985c9966248d5c9162bc70cea39667fc044](https://github.com/advanced-rest-client/raml-docs-method-viewer/commit/02221985c9966248d5c9162bc70cea39667fc044))
* updated component to work with new parser output ([fa24b1fecf950dbaab493d966bfddd2d8ad35926](https://github.com/advanced-rest-client/raml-docs-method-viewer/commit/fa24b1fecf950dbaab493d966bfddd2d8ad35926))



<a name="0.1.6"></a>
## [0.1.6](https://github.com/advanced-rest-client/raml-docs-method-viewer/compare/0.1.5...v0.1.6) (2016-12-13)

Expand Down
7 changes: 4 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"raml-docs-helpers": "advanced-rest-client/raml-docs-helpers#^1.0.1",
"raml-path-selector": "advanced-rest-client/raml-path-selector#^1.0.0",
"raml-path-to-object": "advanced-rest-client/raml-path-to-object#^1.0.0",
"arc-demo-helpers": "advanced-rest-client/arc-demo-helpers#^1.0.4"
"arc-demo-helpers": "advanced-rest-client/arc-demo-helpers#^1.0.4",
"raml-js-parser": "advanced-rest-client/raml-js-parser#^1.1.3"
},
"ignore": [
"**/.*",
Expand All @@ -54,5 +55,5 @@
"test",
"tasks"
],
"version": "0.1.6"
}
"version": "0.1.7"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "raml-docs-method-viewer",
"version": "0.1.6",
"version": "0.1.7",
"license": "Apache-2.0 OR CC-BY-4.0",
"description": "Documentation view for the method defined in RAML file",
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion raml-docs-method-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2>Request</h2>

<div class="url-area">
<div class="method-value">[[raml.method]]</div>
<div class="url-value">[[raml.absoluteUrl]]</div>
<div class="url-value">[[raml.absoluteUri]]</div>
</div>

<h3 hidden$="[[!hasParameters]]">Parameters</h3>
Expand Down
41 changes: 37 additions & 4 deletions test/basic-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
<script src="../../iron-test-helpers/test-helpers.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>

<!-- Step 1: import the element to test -->
<link rel="import" href="../../raml-js-parser/raml-js-parser.html">
<link rel="import" href="../raml-docs-method-viewer.html">
</head>
<body>

<test-fixture id="parser">
<template>
<raml-js-parser normalize-raml></raml-js-parser>
</template>
</test-fixture>
<test-fixture id="basic">
<template>
<raml-docs-method-viewer></raml-docs-method-viewer>
Expand All @@ -32,10 +37,38 @@
<script>
/* global suite, test, fixture, assert */
suite('basic', function() {
test('`raml-docs-method-viewer` should be initialized', function() {
var element = fixture('basic');
assert.equal(element.isAttached, true, 'element.isAttached equals true');
var element;
setup(function(done) {
var baseUrl = location.href.substr(0, location.href.lastIndexOf('/') + 1);
element = fixture('basic');
var parser = fixture('parser');
parser.loadApi(baseUrl + 'test.raml')
.then(function() {
element.parentEndpoint = parser.get('latestJson.specification.resources.0');
element.raml = parser.get('latestJson.specification.resources.0.methods.0');
done();
})
.catch(function(e) {
done(e);
});
});

test('hasBody should be false', function() {
assert.equal(element.hasBody, false);
});

test('Should compute parent endpoint name', function() {
assert.equal(element.parentName, '/{orgId}');
});

test('Should compute method name', function() {
assert.equal(element.methodName, 'get');
});

test('Hiddenshould be false', function() {
assert.equal(element.hidden, false);
});

});
</script>

Expand Down
59 changes: 59 additions & 0 deletions test/test.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#%RAML 1.0
title: My API with Types
mediaType: application/json
types:
Org:
type: object
properties:
onCall: Alertable # inherits all properties from type `Alertable`
Head: Manager # inherits all properties from type `Manager`
Person:
type: object
discriminator: kind # reference to the `kind` property of `Person`
properties:
firstname: string
lastname: string
title?: string
kind: string # may be used to differenciate between classes that extend from `Person`
Phone:
type: string
pattern: "^[0-9|-]+$" # defines pattern for the content of type `Phone`
Manager:
type: Person # inherits all properties from type `Person`
properties:
reports: Person[] # inherits all properties from type `Person`; array type where `[]` is a shortcut
phone: Phone
Admin:
type: Person # inherits all properties from type `Person`
properties:
clearanceLevel:
enum: [ low, high ]
AlertableAdmin:
type: Admin # inherits all properties from type `Admin`
properties:
phone: Phone # inherits all properties from type `Phone`; uses shortcut syntax
Alertable: Manager | AlertableAdmin # union type; either a `Manager` or `AlertableAdmin`
/{orgId}:
get:
responses:
200:
body:
application/json:
type: Org # reference to global type definition
example:
onCall:
firstname: nico
lastname: ark
kind: admin
clearanceLevel: low
phone: "12321"
Head:
firstname: nico
lastname: ark
kind: manager
reports:
-
firstname: nico
lastname: ark
kind: admin
phone: "123-23"

0 comments on commit 50e6d68

Please sign in to comment.