Open smil2k opened 5 years ago
Maybe resolving all of the refs makes it easier. I do it externally currently, but I would have expected it to be done:
const http = require('http');
const express = require('express');
const swaggerize = require('swaggerize-express');
const refParser = require('json-schema-ref-parser');
const morgan = require('morgan');
app = express();
const server = http.createServer(app);
refParser.dereference('./api-docs/swagger.yaml')
.then(function(schema) {
app.use(morgan("dev"));
app.use(swaggerize({
api: schema,
docspath: '/api-docs',
handlers: './handlers'
}));
server.listen(10010, 'localhost', function () {
app.swagger.api.host = server.address().address + ':' + server.address().port;
});
})
.catch(function(err) {
console.error(err);
});
I think I'm running into exactly this on query parameters as well. It's partly because it's using it as a key in a dictionary:
if (def.parameters) {
def.parameters.forEach(function (parameter) {
validators[parameter.in + parameter.name] = parameter;
});
}
And with a ref, those things aren't there.
Example: ...
validator.js does not call $ref resolution before enjoi at line 97. Suggested fix: