swagger-tools
swagger-tools copied to clipboard
Is there a version that works with apigee?
As the title suggests, the latest release does not work on with apigee because of a dependency on superagent which uses const. Is there any version of this library which is verified as working on the platform?
Relevant code:
var swaggerDoc = require('./swagger.json');
var AWS = require('aws-sdk');
var express = require('express');
var lambdaConfig = require('./config.json');
var spec = require('swagger-tools').specs.v2;
console.log("Configured for '" + lambdaConfig.environment + "' environment");
var lambda = null;
var app = express();
app.use(bodyParser.json());
app.post('/', function (req, res) {
spec.validateModel(swaggerDoc, '#/definitions/PaperPencilTestData', req.body, function (err, result) {
if (result) {
console.log('Swagger model failed validation:');
console.log('Errors');
console.log('------');
result.errors.forEach(function (err) {
console.log('#/' + err.path.join('/') + ': ' + err.message);
});
buildErrResponse(err, res);
// Since this is schema validation, warnings shouldn't be populated
} else {
console.log('Swagger model is valid');
}
});
var conf = initiateAWS(req);
invokePostLambda(req.body, res, conf);
});
app.listen(9000, function () {
console.log('Example app listening on port 9000!');
});
stack trace from apigee
illegal character illegal character at module.js:439 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/path-loader/lib/loaders/http.js:29 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/path-loader/index.js:33 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/json-refs/index.js:35 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/swagger-tools/lib/helpers.js:37 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module
.js:380) at /organization/environment/api/node_modules/swagger-tools/index.js:29 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/apigee_invoke_lambda.js:6 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:497 at startup (trireme.js:142) at trireme.js:923