Open jsdevel opened 8 years ago
If you want to use external references like this, you can use extrefs
module to resolve them in advance.
That being said, we need to build support for this in directly.
HI i am facing same problem . The middleware is not working with documents which contain '$ref' to other json documents which are relative files. thanks
We're working on making references resolve automatically. But the way around this is to resolve references before hand:
import Express from 'express';
import Swaggerize from 'swaggerize-express';
import Resolver from 'extrefs';
const app = Express();
Resolver(api).resolve((error, schemas) => {
app.use(Swaggerize({ api, handlers, schemas}));
//etc
});
I'm now using express-openapi, and find it's usage of jsonpath
to be a lot more stable. Perhaps switching to jsonpath
would make the transition smoother and resolve a lot of other validation bugs?
We're working on conversion to use swagger-parser but integration with an asynchronous resolver requires some work to maintain consistency with the current API.
I kept getting this with something like
"$ref": "Address.json"
in one of my definitions. The definition file had a siblingAddress.json
file in the same directory.Here's the error:
Not really sure how it could work though as
swaggerize-express
is expectingdefinitions
to be an object:See the docs for reference object