Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Convert 'x-*' security types to 'apiKey' #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,16 @@ function parseSecuritySchemes(ramlSecuritySchemes) {
if (ramlSecurityObj.type === 'OAuth 1.0')
return;

var srType = {
'OAuth 2.0': 'oauth2',
'Basic Authentication': 'basic',
}[ramlSecurityObj.type];
//Convert 'x-*' types to 'apiKey'
var found = ramlSecurityObj.type.match(/^x\-/i);
if (found) {
var srType = 'apiKey';
} else {
var srType = {
'OAuth 2.0': 'oauth2',
'Basic Authentication': 'basic',
}[ramlSecurityObj.type];
}
assert(srType);

var srSecurity = {
Expand Down