-
Notifications
You must be signed in to change notification settings - Fork 370
Apigee integration #490
Comments
What Apigee integration are you looking for? This library has nothing in it specific to or directly supporting Apigee. |
I'm trying to run this library inside an Apigee Edgemicro Plugin (EMG). So, there isn't any integration between EMG and this library, right? |
Let me see if @theganyo can help out, he's worked on Edge Microgateway more recently than myself. In theory, |
Okay, I'll wait news, thanks for the quick reply. |
No. There is no integration with swagger-tools and microgateway. |
I hope I'm not annoying, just one more question, it's possible validate swagger doc without run a local server? I tried initialize the middleware with metadata and swaggerValidator, so when I need to validate just calling: middleware.swaggerValidator() but seems like doesn't work |
The validation that I mentioned is about incoming request, for example: |
|
Yes, this is the guy that I want, but trying to validate without running a server seems like I need to do a lot of "workaround" that's not good. |
Looking at https://github.com/apigee-127/swagger-tools/blob/master/docs/Middleware.md, it seems that What if we want to call the middleware ourselves outside of any init context? middleware = XXX // how to get that value?
module.exports.init = function (config, logger, stats) {
[...]
return {
onrequest: function (req, res, next) {
middleware.swaggerValidator(req, res, function(err, data) {
if(err) {
return next(err)
}
/*do some other work, like per-parameter input-validation*/
next()
})
}
} |
Well, this is more than possible but only suggested if you're 100% sure your Swagger document is valid. The whole purpose of As for doing this, you can require the middleware just like you would any other: var swaggerMetadata = require('swagger-tools/middleware/swagger-metadata');
var swaggerValidator = require('swagger-tools/middleware/swagger-validator');
// ...
app.use(swaggerMetadata(yourFullyResolvedSwaggerDocument));
app.use(swaggerValidator());
// ... Documentation on the middleware functions: |
Sounds good @whitlockjc : Seems like I can hook the Swagger documentation validation middleware to my own init context & then the individual req/res validation to the per-request context. |
You might find the
|
|
True, This is important for me because 20% of my swagger spec is built dynamically during my app's startup. I don't have a canonical Thanks for the reply. Apologies for derailing this thread. |
You're not derailing, I would just hate to see you moving to other things when there is no need. As for the |
Also, if unit tests are the only reason you need to catch things, you can do the same thing that |
Yeah, I recently learned about Appreciate the tip re: |
|
Where is apigee integration? As I can see on this repo I need to run a local service to validate swagger doc.
The text was updated successfully, but these errors were encountered: