-
Notifications
You must be signed in to change notification settings - Fork 257
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
Support for OpenAPI3 #84
Comments
another option for the new key |
There seem to be quite a lot of changes for OpenAPI 3.0. Would all of it need to be implemented here? https://swagger.io/blog/news/whats-new-in-openapi-3-0/ |
I think the core change is for the content-negotiation & better json-schema mappings. The rest (security &) are anyway left for client apps / libs to do as there are no existing helpers in reitit for those. |
I think we could move the swagger parameter mapping from spec-tools and schema-tools into Much easier to develop as it's all under one repo, open even opportunity to share code between the three impls. |
Where to find the relevant (swagger2) code with malli: |
In case it helps someone, until this issue is solved I created a hacky conversion from the existing reitit Swagger output to an OpenAPI spec. I first wrote it when I was using Spec coercion, but now I've moved to using Schema, so I'm not as confident about what gets generated from a Spec. I've been quite happy with my generated OpenAPI specs using this. There are definitely gaps in functionality that I don't need/haven't run into yet, but it's something. https://gist.github.com/czan/8752cacf527ceb0e64982b9fa8747892 |
I'm currently working on this issue and hopefully this can be closed soonish |
@Koura How far did you get with this? |
@danielneal Sorry for the radio silence and slow progress. I haven't really been able to progress this for the last few months but should be able to continue now. Afaik support for schema and specs is already done but haven't yet been taken into use on reitit side. I have a WIP for the malli side of things |
Hi all, just jumping in here while trying to get my api integrated with some OpenAPI V3 tools. The gist from @czan works well. I recommend incorporating the following patch which helped me to get my /openapi.json validated. 66,69c65,68
< (assoc (dissoc endpoint :produces)
< :parameters non-body-parameters
< :requestBody fixed-body-parameter
< :responses fixed-responses)))
---
> (cond-> (dissoc endpoint :produces :consumes)
> non-body-parameters (assoc :parameters non-body-parameters)
> fixed-body-parameter (assoc :requestBody fixed-body-parameter)
> fixed-responses (assoc :responses fixed-responses)))) |
@Koura Swagger2 has annoying deficiencies like missing support for anyOf, so even a WIP would be interesting to see, and possibly to continue from. |
OpenAPI 3.1 claims to be 100% compatible with JSONSchema, which already has support in, for example, Malli. Perhaps it would be feasible to skip 3.0 and go straight to the newest version, even if the ecosystem hasn't for most parts migrated to it (based on https://openapi.tools/). |
+1 🙂 |
Thank you so much @ikitommi and @Koura for all the open-source marvels to which you've contributed! I'd really be interested in having the latest version of OpenAPI (3.0, 3.1, 3.x?) supported by malli. Off the top of my head here are the features of OpenAPI (3.x) that I miss in Swagger (2.0):
If somehow you had enough free brain time to dump a list of tasks yet to be completed so as to move toward all reitit coercions supporting OpenAPI, I think it might be helpful for the wider community to try and contribute – happy to look at it and see what I can do 🙂 |
This would be really cool for integration with stoplight - it takes swagger but its not happy with it |
+1 need this feature as well. |
What's the current status of this work? I may be willing to throw some cycles at it. Having support for OpenApi 3.x would really be nice. |
@grzm Afaik, there's this open PR that requires review.
Until metosin can review it, if you can spare some time I think it might be nice to test it in an actual project and report any problems (I've been meaning to do that for a while...). |
FYI I'm working on this at metosin, trying to get all the various contributions glued together and adding the missing pieces. |
Initial support for OpenAPI3 schemas is now in Done:
TODO:
|
One more thing: #605 |
OpenAPI3 support is now out in 0.7.0-alpha1. Blog post here: https://www.metosin.fi/blog/openapi3/ |
This spans over multiple repos, but can be done in parts.
Schema -> OpenAPI3
Spec -> OpenAPI3
spec-tools.swagger
overriding some JSON Schema parts (if any!)Malli -> OpenAPI3
Reitit Coercion
Coercion for all content-types
Coercion per content-type
:content
(from OpenAPI3) which allows content-type->model mappings.... having both
:body
and:content
could be allowed, the:body
could be used as a default if the content-type doesn't match.The text was updated successfully, but these errors were encountered: