Open tlivings opened 9 years ago
You can use the extrefs module (https://www.npmjs.com/package/extrefs) to resolve everything beforehand and pass to the schemas option, but I will be integrating directly as well I think.
sorry, I misunderstood the root cause I'm having, and my issue is unrelated to this - it may not be in this module either
What are you seeing?
I'm still trying to iron out where the issue is occurring, but basically I see validation stop if I change from an in-route definition to a reference. I'm using swaggerize-restify & swaggerize-routes, as well as some more custom code
again, I'm still trying to find out what portion of code is causing this strange behavior, I don't know if it's any of the krakenjs/* stuff or in house code, but if you have any hints on what to investigate, I'd be extremely appreciative - thanks for taking the time to respond already
I have the same symptoms as @paul42 . using swaggerize-routes implicitly via swaggerize-hapi -- when using $ref, validation stops.
I figured out what was wrong. In my case, I had type:"object"
along with the $ref and that was causing the enjoi module to attempt resolving the schema as an object. I removed the "type" field, and it started validating again. Hope this helps someone else
@tlivings I'm looking to make this happen myself and submit a pull request. I plan on using swagger-parser as the main library, but it uses async callbacks. This would require an api change since right now its all synchronous code.
Do you have any aversions to an API change? If you do, do you have any thoughts on adding this functionality?
Yeah, I've considered adding this but the API change, at least for swaggerize-express
gets pretty ugly. Due to the way express bootstraps, having an async swaggerize-routes
would definitely change the dynamic and require something similar to what we do in kraken
which keeps out requests until all bootstrapping is done.
I'm not totally opposed to it. It just presents some additional challenges for integration.
Not trying to troll, but with express-openapi
we actually flipped it. So instead of the library fetching the external schemas, we require the application to fetch them before initializing the app. See https://github.com/kogosoftwarellc/express-openapi#argsexternalschemas.
That's generally what I've recommended people to do before calling swaggerize.
it seems like this is out of scope for the project given the design. I ended up doing the same as yall. this bug is kill
if I'm having this issue, is the currently (only?) workaround to just declare parameters in routes?