dredd-transactions
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0 | ||
expandUriTemplateWithParameters = function(uriTemplate, parameters) { | ||
var ambiguous, e, error, expression, i, j, k, l, len, len1, len2, len3, len4, m, param, parameter, parsed, ref, ref1, ref2, result, text, toExpand, uriParameter, uriParameters; | ||
var ambiguous, e, error, expression, i, j, k, l, len, len1, len2, len3, param, parsed, ref, ref1, result, text, toExpand, uriParameter, uriParameters; | ||
result = { | ||
@@ -33,10 +33,2 @@ errors: [], | ||
} | ||
ref2 = Object.keys(parameters); | ||
for (k = 0, len2 = ref2.length; k < len2; k++) { | ||
parameter = ref2[k]; | ||
if (uriParameters.indexOf(parameter) === -1) { | ||
text = ("\nURI template: " + uriTemplate + "\nDoesn\'t contain expression for parameter") + " '" + parameter + "'"; | ||
result['warnings'].push(text); | ||
} | ||
} | ||
if (parsed['expressions'].length === 0) { | ||
@@ -46,7 +38,7 @@ result['uri'] = uriTemplate; | ||
ambiguous = false; | ||
for (l = 0, len3 = uriParameters.length; l < len3; l++) { | ||
uriParameter = uriParameters[l]; | ||
for (k = 0, len2 = uriParameters.length; k < len2; k++) { | ||
uriParameter = uriParameters[k]; | ||
if (Object.keys(parameters).indexOf(uriParameter) === -1) { | ||
ambiguous = true; | ||
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nParameter not defined in blueprint:" + "'" + uriParameter + "'"; | ||
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nParameter not defined in API description document: " + "'" + uriParameter + "'"; | ||
result['warnings'].push(text); | ||
@@ -57,4 +49,4 @@ } | ||
toExpand = {}; | ||
for (m = 0, len4 = uriParameters.length; m < len4; m++) { | ||
uriParameter = uriParameters[m]; | ||
for (l = 0, len3 = uriParameters.length; l < len3; l++) { | ||
uriParameter = uriParameters[l]; | ||
param = parameters[uriParameter]; | ||
@@ -64,3 +56,3 @@ if (param['required'] === true) { | ||
ambiguous = true; | ||
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nNo example value for required parameter in blueprint:" + "'" + uriParameter + "'"; | ||
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nNo example value for required parameter in API description document: " + "'" + uriParameter + "'"; | ||
result['warnings'].push(text); | ||
@@ -67,0 +59,0 @@ } else { |
@@ -56,2 +56,10 @@ // Generated by CoffeeScript 1.10.0 | ||
ref5 = compileRequest(parseResult, httpRequest), request = ref5.request, annotations = ref5.annotations; | ||
if (request) { | ||
transactions.push({ | ||
origin: origin, | ||
pathOrigin: compilePathOrigin(filename, parseResult, httpTransaction), | ||
request: request, | ||
response: compileResponse(httpResponse) | ||
}); | ||
} | ||
ref6 = annotations.errors; | ||
@@ -69,8 +77,2 @@ for (k = 0, len2 = ref6.length; k < len2; k++) { | ||
} | ||
transactions.push({ | ||
origin: origin, | ||
pathOrigin: compilePathOrigin(filename, parseResult, httpTransaction), | ||
request: request, | ||
response: compileResponse(httpResponse) | ||
}); | ||
} | ||
@@ -85,3 +87,3 @@ return { | ||
compileRequest = function(parseResult, httpRequest) { | ||
var annotations, messageBody, ref1, uri; | ||
var annotations, messageBody, ref1, request, uri; | ||
messageBody = child(httpRequest, { | ||
@@ -92,4 +94,4 @@ element: 'asset', | ||
ref1 = compileUri(parseResult, httpRequest), uri = ref1.uri, annotations = ref1.annotations; | ||
return { | ||
request: { | ||
if (uri) { | ||
request = { | ||
method: content(httpRequest.attributes.method), | ||
@@ -101,3 +103,8 @@ uri: uri, | ||
body: content(messageBody) || '' | ||
}, | ||
}; | ||
} else { | ||
request = null; | ||
} | ||
return { | ||
request: request, | ||
annotations: annotations | ||
@@ -201,3 +208,3 @@ }; | ||
compileParameters = function(hrefVariables) { | ||
var example, i, key, len, member, name, parameters, ref1, ref2, ref3, ref4, types, v, value; | ||
var example, i, key, len, member, name, parameters, ref1, ref2, ref3, ref4, ref5, ref6, types, v, value; | ||
parameters = {}; | ||
@@ -211,3 +218,7 @@ ref1 = content(hrefVariables) || []; | ||
if ((value != null ? value.element : void 0) === 'enum') { | ||
example = content(content(value)[0]); | ||
if ((ref4 = value.attributes) != null ? (ref5 = ref4["default"]) != null ? ref5.length : void 0 : void 0) { | ||
example = content(value.attributes["default"][0]); | ||
} else { | ||
example = content(content(value)[0]); | ||
} | ||
} else { | ||
@@ -218,10 +229,10 @@ example = content(value); | ||
required: indexOf.call(types, 'required') >= 0, | ||
"default": content((ref4 = value.attributes) != null ? ref4["default"] : void 0), | ||
"default": content((ref6 = value.attributes) != null ? ref6["default"] : void 0), | ||
example: example, | ||
values: (value != null ? value.element : void 0) === 'enum' ? (function() { | ||
var j, len1, ref5, results; | ||
ref5 = content(value); | ||
var j, len1, ref7, results; | ||
ref7 = content(value); | ||
results = []; | ||
for (j = 0, len1 = ref5.length; j < len1; j++) { | ||
v = ref5[j]; | ||
for (j = 0, len1 = ref7.length; j < len1; j++) { | ||
v = ref7[j]; | ||
results.push({ | ||
@@ -228,0 +239,0 @@ value: content(v) |
{ | ||
"name": "dredd-transactions", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Compiles HTTP Transactions (Request-Response pairs) from API description document", | ||
@@ -5,0 +5,0 @@ "main": "lib/dredd-transactions.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198077
2412