-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make securedBy: [ null ] consistent with no security. (#20)
* 4.0.2: fixed Node 4 support, tested with NVM * Make `securedBy: [ null ]` consistent with no security. * Fix up lint complaints. * Force checkout in unix style, because the linter will complain.
- Loading branch information
1 parent
abe18a8
commit c30c5b5
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.js text eol=lf | ||
*.raml text eol=lf |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#%RAML 1.0 | ||
title: Secured By Null | ||
|
||
securitySchemes: | ||
oauth_2_0: | ||
type: OAuth 2.0 | ||
describedBy: | ||
headers: | ||
Authorization: string | ||
responses: | ||
401: | ||
description: Invalid or expired token. | ||
settings: | ||
accessTokenUri: /token | ||
authorizationGrants: [ client_credentials ] | ||
|
||
/A: | ||
get: | ||
securedBy: [ null ] | ||
|
||
/B: | ||
get: | ||
|
||
/C: | ||
get: | ||
securedBy: [ oauth_2_0 ] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-env node, mocha */ | ||
|
||
'use strict'; | ||
|
||
const raml2obj = require('..'); | ||
const assert = require('assert'); | ||
|
||
describe('raml2obj', () => { | ||
describe('secured-by-null.raml', () => { | ||
let obj; | ||
|
||
before((done) => { | ||
raml2obj.parse('test/secured-by-null.raml').then((result) => { | ||
obj = result; | ||
done(); | ||
}, (error) => { | ||
console.log('error', error); | ||
}); | ||
}); | ||
|
||
it('should make securedBy consistent', () => { | ||
const A = obj.resources[0]; | ||
const B = obj.resources[1]; | ||
const C = obj.resources[2]; | ||
assert.strictEqual(A.relativeUri, '/A'); | ||
assert.strictEqual(B.relativeUri, '/B'); | ||
assert.strictEqual(C.relativeUri, '/C'); | ||
assert.strictEqual(A.methods[0].securedBy, undefined); | ||
assert.strictEqual(B.methods[0].securedBy, undefined); | ||
assert.strictEqual(C.methods[0].securedBy.length, 1); | ||
assert.strictEqual(C.methods[0].securedBy[0], 'oauth_2_0'); | ||
}); | ||
}); | ||
}); |