-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add OpenAPI Specification support (Version 2.0) #347
Conversation
Are you still working on this, or do you want a helping hand? I'd love to replace our manual generation of Swagger docs with this. |
@mroach Hi, right now I stop work on improving it because have no free time. I'm using it in few projects already but it still messy and little bit tricky. So if you can finish it and totally merge to main repo it will be very nice! |
Thanks for that it works well, using your branch in my Gemfile for now! Would be very happy if that could be merged to master one day |
@stephanebruckert thank you. Nice to hear that. I also still using that. I'll write docs in README later because it even includes few more helpers and features. |
Hey @djezzzl and @stephanebruckert stumbled upon this branch... Down to help out with this as well. We've been using this gem to generate apiblueprint, but swagger has some obvious advantages. Are you guys still working on anything here? |
@jwg2s Hello, I'm just using it. Because for my tasks it's complete and ready to use. I'm not sure I did kind of demo in example project or document new created helpers so if you need any help just ask. |
@djezzzl been using it now with success. Have any pointers for how to include example request bodies? That's the biggest thing I see missing that would definitely be useful. Thinking this: https://swagger.io/docs/specification/2-0/describing-request-body/ EDIT: Was actually reading the v3 swagger format, seems like v2 doesn't support example request bodies? |
@jwg2s @stephanebruckert . It's already possible. I make it like following:
|
@djezzzl thanks for getting back to me so quick. I've been making some changes to handle edge-cases that we've run into which I'm happy to share upstream if you'd like. EDIT: Nevermind, I see that it's generated from a combination of |
@jwg2s
Description of that parameter in docs will become: What you need to is to send as body of request. You just need to set parameter as |
@djezzzl thanks for that explanation - definitely helped. Is there any reason we're not deriving example values / types from the request that's generated? For example, with the API blueprint formatter, we've got example request URLs/params/bodies that we can use to automate a lot of this at the gem layer as a default, and developers would only have to override. If you were going to go about that, where would you start? If you point me in the right direction, I can knock it out and open a PR to your swagger branch |
@jwg2s Why do you think we are not? We actually do. You can skip writting type / value of parameter if you provide an example value using |
Any update on this? |
Unfortunately, not from me at least. I still didn't get any response from Owner/Contributors. So I didn't update the PR to the latest version of the gem but it's working 👍 |
Sorry for the delay on this. I'm mostly concerned about this set of numbers That said, if this is working for people I am fine merging it after the conflicts are fixed. |
@oestrich, hard to call that "delay" but no problem :) I'm not working on this right now. So, sorry, I left a checklist for myself but most of important and must have logic is working. We can try to pair/call when I update this PR that I can fast explain you all the changes. I also want to know your opinion on the idea at all. So if you can confirm that you'd like to merge this I can prepare a PR. Can you? |
@djezzzl Yeah I am behind getting a swagger writer in. I just did a quick scan of this and it looks good. Two things though, there's some commented out specs in spec/writers/swagger_writer_spec.rb and then I think you commited a test generation of docs? There's a The rest seems good 👍, fix those merge conflicts and once travis is passing I can merge in and I'll do a major bump since this is a pretty big new thing. |
@djezzzl are you proposing making a different PR from this one? At first glance it seems there may be change in this PR that seems unrelated to the functionality. I think either @oestrich or myself are happy to give feedback, but if you need help bringing this over the finish line its best to ask specifically for something. Docs would help too, but I don't think either of us has projects using Swagger, so would be up to others interested to help you get this finished. In general, I think think the idea of adding swagger/OpenAPI support as a feature should be merged. |
@oestrich @jakehow Wow, thank you, guys! Glad to see your interest. I won't make different PR but I'll update this one and also will improve it. Because the first time I started on it I was needed it ASAP. Now I can make things more clearly. So, I hope by the end of this week I'll prepare the PR. If not this, the next should be enough. |
Just to confirm: |
@kurko @marnen @jonathanpa @samwgoldman Hi guys, somebody of you able to merge this PR? |
@djezzzl Hey, sorry I didn't forget about this. Couldn't get to this until after the weekend. |
@oestrich No problem. Great, it's merged 👍 |
The PR adds a support for OpenAPI Specification. This is already used by some projects and it works. There are some things like
oauth2 security
not implemented yet. But most of the required functionality to able to work with famous Swagger UI are done.