Skip to content
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

open API 3.0 spec support #128

Open
leslie-wang opened this issue Jan 31, 2017 · 55 comments
Open

open API 3.0 spec support #128

leslie-wang opened this issue Jan 31, 2017 · 55 comments

Comments

@leslie-wang
Copy link

OpenAPI will release version 3.0 at Feb 28, 2017. https://www.openapis.org/blog/2017/01/24/a-new-year-a-new-specification. It would be useful if this tool can support 3.0 as well.

@AlJohri
Copy link

AlJohri commented Mar 13, 2017

@whitlockjc I was wondering if there's any plans to start supporting the OpenAPI 3.0 spec. Thanks!

@whitlockjc
Copy link
Member

We definitely plan on supporting it but I'm not 100% sure how to do it yet. In swagger-tools, a lot of heft and complexity comes from having a single library with support for multiple specs in it. I need to figure out how I want to support this.

Note: OpenAPI 3.0 is NOT GA yet but now that the Implementer's Draft is out, we should start working on this soon.

@gooftroop
Copy link

Any update on this now that it's GA?

@whitlockjc
Copy link
Member

We're wrapping up the next sway release, bug/security fixes and enhancements. After that, 3.0 support will be our top priority. Sorry for the delay.

@nomadtechie
Copy link

@whitlockjc is there anything you need help with to get 3.0 support out? Happy to contribute.

@osher
Copy link

osher commented Jan 30, 2018

@whitlockjc - same question here. If it'd help if I join the effort - please contact me. theganyo has my private mail as I did some PRs for swagger-node-runner / bagpipes.

@amarzavery
Copy link

@whitlockjc - Any plans to move to 3.0 Open API spec? 3.0 is GA now. Folks have been asking for this since last year. I know you are super busy. We really love this library. It would be great if you can provide an approximate timeline on when will this be possible?

@osher
Copy link

osher commented Jun 5, 2018

Guys, I suppose it's down to us to fork and get on with it. Or maybe start from scratch in pure ES7 porting the good stuff.
Sadly, my current occupation does not involve swagger at all, but if it did - I't totally would have started by now. But my current position does not leave me much free time for efforts that do not promote the projects' main goals

@whitlockjc
Copy link
Member

I don’t see why threatening to fork is required when a PR, or PRs, would suffice. I’ve been the only active developer in this project from day one and like you, I’ve run into time conflicts lately. I’ve been trying to pick it back up (look at yesterday’s commits) but it’s not going to ever be as quick if I’m the only one doing it. 3.0 support will likely take some time and will likely require changing the architecture a bit but I’m more than happy to be involved. I will just need some help. If you think a fork is the best approach, by all means.

@amarzavery
Copy link

I don't think it was a threat of any kind. All of us love this repo and the work done by you over here. Since you are the main and only author of this repo, people are expecting a response from you on 3.0 support. @osher posted a comment on Jan 30 and I posted one 7 days ago asking for a timeline if any. This gives us the idea about where the project is heading with 3.0. It took slightly strong words from @osher for you to respond.

Anyways, I can completely understand the time constraints and you working on this project in extra time. More hands on this project would definitely help. I shall discuss this with my team to see what is the priority for 3.0 support and based on that would love to contribute in keeping this project open api 3.0 compliant.

Thank you once again for your response. Have a good day 👍 .

@whitlockjc
Copy link
Member

Well, let's make this happen. I'm putting in the time now and I'd love some help. My plan is to release 2.0.0 by EOW (barring any unexpected conflict) and then focusing on OAI v3.x support.

@osher
Copy link

osher commented Jun 9, 2018 via email

@celalo
Copy link

celalo commented Jul 25, 2018

Any news on OAI v3.x support?

@whitlockjc
Copy link
Member

Now that [email protected] is released, OASv3.x support is the next major feature being worked on for sway.

@celalo
Copy link

celalo commented Jul 25, 2018

Thank you very much for your immense efforts. I believe, OASv3.x support will need quite a lot of work but do you have a rough timeframe? Do you think it will take days, weeks or months? (I also presume, OASv3.x support will not land to swagger-tools project, since it's deprecated in favor of sway)

@whitlockjc
Copy link
Member

I honestly have no idea how long it will take. Last I heard, [email protected] doesn't even have a JSON Schema to use yet. So I need to figure out how that looks, what the delta is and go from there. I don't think the sway API itself will change much since the JavaScript objects we expose shouldn't change much and when it comes to the features available on them, they shouldn't change much either. Just know, this is me taking a guess and this could all be grossly inaccurate. ;)

@whitlockjc
Copy link
Member

Excuse my naivety...

@philsturgeon
Copy link

philsturgeon commented Jul 25, 2018

They OpenAPI folks are still working on that, but this v3.0 metachema is usable despite being labeled as WIP. OAI/OpenAPI-Specification#1270

It’s being used in a lot of tools like oas-kit: https://github.com/Mermade/oas-kit/tree/master/packages/oas-validator/schemas

@whitlockjc
Copy link
Member

Fair enough. I'm on the TSC and I know that it's a WIP but building on top of a WIP worries me a little, although I'm not against it.

@philsturgeon
Copy link

philsturgeon commented Jul 25, 2018 via email

@whitlockjc
Copy link
Member

Oh, I didn't take it that way. :) I wasn't pulling rank either but I can see how it could be taken that way.

@whitlockjc
Copy link
Member

Speaking of...any ideas on how you'd like sway to work with multiple versions of OAS? As we support multiple concurrent versions of the spec, you get to the point where the size of sway will increase. Also, since these JSON Schemas are JSON they are not typically minified during browser builds. I'm thinking of creating JSON object versions of them to remedy this. Thoughts?

@philsturgeon
Copy link

Many tools implement an adaptor pattern approach, where a base class covers the most basic common functionality and inheritence covers the rest. You'd probably have distinct v2 and v3 base classes, and v3.1 could extend from v3.0, etc.

Or you can use mixins to cherry-pick functionality from a whole bunch of things.

This JSON Schema library does something similar: https://github.com/davishmcclurg/json_schemer/tree/master/lib/json_schemer/schema

Also, with oas-kit covering a lot of the same functionality as you, but already supporting v3.0 rather well, I'd see if there was any functionality could combine. Even using their resolver and/or walker would help you delete some code. There are quite a few Node modules floating around now, and it would be great to see things combinging so we can all work on building awesome tooling on top of that base layer of components, instead of all competing to build this same components and being stuck on step 1. :)

@whitlockjc
Copy link
Member

I'm all for collaboration. Being one of the first on the block for such things (sway started 2 years before oas-kit and was written to replace swagger-tools which was even older), I was surprised more people didn't contribute to my projects and would start their own. I've never pushed anyone away and I've been quite receptive to criticism and feedback. I'll stay in my lane for now and if people want to collaborate, I'd love to.

@philsturgeon
Copy link

Excellent. Well, oas-kit is brand new but based on the logic from swagger2openapi, and of course exists because there are no v3.0-based tools out there. I wasn't suggesting ditching your thing because a new thing came along, but was suggesting you take a look at the multiple components they have to see if any of them can replace 2.0-only code you have there.

Another cool approach is to support v3.0 only, and use their swagger2openapi logic to convert in the background. That can really save some effort. :)

Either way, good luck with the v3.0-based tooling built on that WIP metaschema. I'm nudging the OpenAPI folks to get that finished up!

@whitlockjc
Copy link
Member

I do like that idea. I'll reach out to @MikeRalphson to see what his thoughts are.

@DavidBiesack
Copy link

I suggest not claiming that master supports v3 as a work in progress.
I recommend creating a separate branch for the 3.0 work.
At APIStrat, Jeremy asked about approaches for 3.0 support - I'd like to see sway support both "swagger: 2.0" and "openapi: 3.0.1" at the same time (same code base), rather that forking the tool. That's my opinion, tho.
I don't recommend doing so via an implicit conversion (ala api-spec-converter or other), since error messages would become perturbed, perhaps pointing to paths such as /components/schemas (that do not appear in the 2.0 source) instead of /definitions

@whitlockjc
Copy link
Member

I fixed the supported version in the README files. And thanks for the feedback. I like that approach too.

@RomanHotsiy
Copy link

Hey @whitlockjc, what is the current progress with this?
I mean if I start using code from master, what is still missing?

Do you need any help?

@whitlockjc
Copy link
Member

Progress is ongoing but not complete. Doing it alone means slower than ideal delivery. I'll try to get it out sooner.

@osher
Copy link

osher commented Jan 1, 2019

@whitlockjc - just to give you some kudos.
I'm sorry I can't offer help ATM, by the time things got going - I sunk over my head.
So - kudos. that's the least I can do!

@whitlockjc
Copy link
Member

No worries. I've been dragging my feet due to no official JSON Schema for [email protected] but I'm going to take a different approach starting today.

@philsturgeon
Copy link

philsturgeon commented Jan 2, 2019

@whitlockjc hey, is that new approach using the WIP? I don't want to sound like a dog with a bone but you could get a long way using that WIP and it shouldn't mess you up if they release an official metaschema during that time. If you've got a big healthy test suite then it'll aaaaall be fine. Probably. Right? :D

@whitlockjc
Copy link
Member

The master branch is the WIP and it's where I'll be doing the work. I may end up creating a new OSS project for the types/validation of the OAS document, something that would address parts of #187, but I'm not 100% sure on that yet. Regardless, all of this is being done in master at this time.

@MikeRalphson
Copy link
Contributor

I think @philsturgeon meant the WIP json schema(s).

@whitlockjc
Copy link
Member

Ah yes. If I continue with the JSON Schema based approach, that's what I'll do. I'll make a decision here shortly.

@philsturgeon
Copy link

How's this coming along? Is there any of the tooling we can align on?

  1. stoplightio/json-ref-resolver has a few really handy local file, HTTP, or both $ref resolvers
  2. BiteBit/ajv-oai handles the validation by wrapping AJV with the OpenAPI v3.0 metaschema we discussed above (now merged!)

I know this tool has been around a long time but with these other tools marching forwards recently I feel like there is an opportunity to offload some maintenance burden to existing tools.

@whitlockjc
Copy link
Member

Object model is complete, structural validation is complete. Semantic validation is almost complete. I will then do request/response validation and cut a release. The plan is to remove support for mock/sample generation for now. We can bring it back pretty easily, but the current approach brings in so much bulk that I don't want to stick with it if we don't have to.

Thanks for your patience.

@whitlockjc
Copy link
Member

whitlockjc commented Aug 22, 2019

I'm glad you pointed me to stoplightio/json-ref-resolver, I didn't know they too were writing their own version of json-refs. I've reached out to better understand, I fear fragmentation for no real reason.

@Ilham-Habibullin
Copy link

Is there any updates for now?

@whitlockjc
Copy link
Member

Sorry for the delay, but it's nearing completion. Structural document validation for 2.x and 3.x is working, semantic validation is almost done. All that's left then are a few APIs and request/response validation.

@Ilham-Habibullin
Copy link

Ilham-Habibullin commented Sep 17, 2019

I am specifically cared if OpenAPI v3.0 will bring feature with discriminator? Is there any chances that it will be supported in that coming release?

@whitlockjc
Copy link
Member

discriminator is quite difficult to implement but it will be coming.

@elecompte60
Copy link

Any updates on this or is this project dead?

@whitlockjc
Copy link
Member

whitlockjc commented Jan 16, 2020

The project isn't dead, I just happen to be a one-man band so things happen much slower now that working on this isn't part of my day job.

@philsturgeon
Copy link

Maybe now is a good time to split it into a few smaller tools and see if we can find help from the community, getting folks to take ownership of those smaller tools. I'm starting to get together some resources on https://github.com/openapi-contrib, and having a simple validator over there would be massively useful. It would help a lot of people avoid needing to OAS+AJV for validation, which is a major pain point.

@nazarhussain
Copy link

Can't share how much we are in need of this to finish. And I am willing to contribute to my available capacity. It would be nice if you put your time and efforts on planning the tasks for this release, and then community can take up the tasks and help you finish.

@wickedest
Copy link

@whitlockjc - I agree with the above comments - If you can put together a roadmap, then the community can help. E.g. I could fix #218 (not sure why you closed an actual roadmap issue, tbh).

@whitlockjc
Copy link
Member

@wickedest It didn't seem like a roadmap issue because it's not a bug in the 2.x support or a new feature of 3.x, it's just a lack of 3.x that makes your unexpected behavior happen. So to me, completing 3.x support is what is important to track. I could be wrong.

As for everyone else, I'm down with this. I have 3.x support working locally where structural validation works and almost all semantic validation is done that was in 2.x. The delta is new semantic validation required for 3.x, and handling the new approach to requests/responses in 3.x that is not backward compatible with 2.x. I can start committing my work to master so that we can all work together if that would help.

@philsturgeon
Copy link

philsturgeon commented Jan 27, 2020 via email

@alasdairhurst
Copy link

@whitlockjc do you have any update when you will push your changes to master and we'll be able to start contributing to get the ball rolling on 3.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests