New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looking for feedback #3
Comments
@hilkeheremans Just saw the issue you were having in |
@jsdevel Too bad I didn't see this earlier; I had just forked swaggerize-express and stripped off the validation to circumvent the issue. Still, express-openapi looks interesting as well so I'll give it a go. Just as an FYI, I will be combining this with swagger-express-middleware. Expect some feedback tomorrow! |
Sounds good! |
Seems to work perfectly for a very simple use case. FYI, we are using this in what most devs would probably call an enterprise-grade application, with a public API described by OpenAPI. We're still working on the plumbing and robustness. Over the next few weeks we'll be hooking up all our business logic etc, so feedback will get more interesting at that point. Some quick observations. I'm putting them here as they are not feature requests/bug reports, just discussion points and a FYI for users who might want to move from
|
Looking forward to it!
It can either be relative or absolute. Relative is based on the working directory of the running process. Should this be called out in the docs somehow?
You can actually use json or js.
Haven't heard of json5! Looks pretty cool. Again, updating the docs here would likely be good. Thanks for the feedback! I'll spend this week adding more clarification to the docs around these points. |
@skindc should you have any issues with |
@jsdevel It seems I was a little too enthusiastic; express-openapi currently also does NOT handle recursive definitions. See kogosoftwarellc/express-openapi-validation#1 for more details. |
@hilkeheremans see my response kogosoftwarellc/express-openapi-validation#1 (comment). I also updated the tests in this project to use recursion and it works. See |
Hey @jsdevel I've tried it but had some issues with what I was precisely looking to do. Overall it looked like a nice set up. I'm trying to basically mock a swagger-based API with node.js and have validation that resembles what a .NET WebAPI back-end would be returning. I've got endpoints and all set up with Swaggerize-Express but the validation bypasses the handlers and I'm a relative ExpressJS noob so I'm trying to tweak the final output back to the client. We expect a I'm certain there's a way to do this, but I'm just getting started... but when I tried express-openapi I got odd behavior since my swagger spec is already defined, paths and all — I wasn't looking to define the paths in code, just augment them. The moment I put a code-level API handler in the endpoint disappeared from the Swagger UI for some reason. |
@jsdevel sorry I should also have said, I'd be totally game for dropping
But I haven't had enough time to get that working so I had to move on for the moment. Are there any examples in the Tests that would show effectively what I need? I'm 100% certain there's a way to do this, but I just haven't had time to figure it out. |
@rcherny I think what you may be looking to do is intercept the validation errors, and change the status code. If so, put some error catching middleware (defined with 4 parameters) as the last middleware in your chain like so:
|
Hey @jsdevel that's exactly what I ended up doing, more or less. The issue though is really that the |
I think you'll be pleasantly surprised 😄 |
@rcherny checkout the multiple errors returned in this data driven test: https://github.com/kogosoftwarellc/express-openapi-validation/blob/master/test/data-driven/fail-multiple-invalid-path-params.js |
@asaf not sure if you're using |
Hey @jsdevel I am using |
You'll find with
I understand deadlines completely. |
@jsdevel re: the validation issue with Swaggerize ... yeah it's buried pretty deep in the code, I was afraid of that. No I certainly don't want double validation. If you could describe / document how to use But I could be mistaken. I may have time later this week to revisit. |
Sigh. Fat thumbed that on my phone. Sorry. |
@rcherny I have a sample project that's really straight forward. Check it out https://github.com/kogosoftwarellc/express-openapi/tree/master/test/sample-projects/basic-usage. That project is used in the travis builds as well. |
Hi @jsdevel! BTW, it seems |
@MugeSo parameters should be supported, unless I'm not understanding what you mean. |
sorry, I'm not so good at English 😔 |
@MugeSo no worries. So What's probably throwing you off is that you define it in your handler files.
I'm glad you think so! |
@jsdevel It's |
Ah ha! I understand now! Cool! I didn't know swagger supported that. I should be able to add that support easily. Basically just concat the 2 arrays (path parameters and operation parameters). I'll add this support tonight most likely. |
great! |
Added support for custom json schema formats with b01fc0e. Here's an example:
|
@jsdevel I wrote type definition of this package for typescript. If you want, you can port it ;) P.S. |
Super awesome @MugeSo! I'd love to include it. Can you submit a PR? |
@jsdevel OK, I'll do it. |
@dcolens I'd love to get your feedback on |
|
Added support for error middleware that is scoped to the API's basePath property with 9f4b733. |
@johnleetechnology I noticed that you were having issues using $ref in swaggerize-routes. I'd be interested in having you try express-openapi to see if it handles your use case. |
Added |
@rkarodia if you're looking for a swagger module that allows you to transform validation errors, checkout |
I wish something like: // in "routes/my/handler.js"
var openapi = require('express-openapi');
module.exports.post = function(req, res, next) {
req.status(204)
.header('Content-Location',
openapi.resolveRoute('someOperationId', {paramName: 'foo'})
.json({progress: 0});
} |
How about to add app.mountpath to |
@MugeSo adding app.mountpath would be good. Can you submit a PR for that? |
@MugeSo what would the use case of |
@jsdevel OK, I'll send PR for app.mountpath
Now I think |
Oh I see what you mean. Cool! Can you submit a PR for that as well? |
@jsdevel No, I can't because |
@MugeSo makes sense. I feel |
Thanks to @MugeSo, |
@jacob-zneider just saw the issue you submitted on swaggerize-express. The main issue with that library is that it doesn't rely on jsonschema. Swagger/openapi are built on jsonschema, so any library not build on top of that is almost doomed to fail. I'd love to know what you think about |
@marcofranssen |
Added support for collectionFormat to array coercion
Allow to send challenge for other than 403 response
This issue is to request feedback from the community so
express-openapi
may be improved. For any who wish not to be apart of this, please comment herein withplease remove me
and I'll delete any comment herein containing your @ mention.The text was updated successfully, but these errors were encountered: