This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-23
Channels
- # aws-lambda (1)
- # bangalore-clj (3)
- # beginners (80)
- # boot (8)
- # clojars (1)
- # clojure (200)
- # clojure-dev (37)
- # clojure-greece (26)
- # clojure-italy (11)
- # clojure-norway (3)
- # clojure-russia (14)
- # clojure-spec (21)
- # clojure-uk (30)
- # clojurescript (50)
- # core-logic (10)
- # core-matrix (1)
- # cursive (15)
- # data-science (21)
- # datomic (45)
- # devcards (2)
- # emacs (4)
- # fulcro (12)
- # garden (2)
- # jobs (5)
- # juxt (1)
- # lambdaisland (1)
- # leiningen (4)
- # luminus (20)
- # lumo (26)
- # off-topic (33)
- # onyx (27)
- # parinfer (1)
- # pedestal (3)
- # perun (5)
- # re-frame (20)
- # reagent (27)
- # ring (1)
- # ring-swagger (21)
- # shadow-cljs (259)
- # spacemacs (14)
- # yada (3)
@nha that’s a bug, should produce something like :x-oneOf
~like spec-tools does (https://github.com/metosin/spec-tools/blob/master/src/spec_tools/swagger/core.cljc#L19-L23). Would you like to do a PR?
Plan has been to move the Schema->JSON Schema conversion to Schema Tools at some point, and add the support for OpenAPI 3. Schema-tools & Spec-tools would do same stuff, and ring-swagger would be just a lite proxy in front. Contributions welcome.
Ok good to know it’s a known bug 🙂 I can try to make a PR yes (in my limited free time however - we don’t use swagger at work)
and then once it produces :x-oneOf
- there should be a definiton for this somewhere else?
(edit: I can probably find out just by generating a json with metosin/spec-tools)
also - thanks for making these! 🙂
@nha thanks! spec-tools has some best-guess samples (https://github.com/metosin/spec-tools/blob/master/test/cljc/spec_tools/swagger/core_test.cljc#L15-L137) that can be used. Not 100% sure they are correct, so please fix if you find something odd - or just something working differently for Schema/Spec.
It seems that not all Schema mappings are verified with the JSON Schema Validator, would be good to have those. Would have caught the :oneOf
error…
I am not sure how to read that, but http://swagger.io/v2/schema.json# has a oneOf
property.
(I noticed just now as well the x-
prefix is defined there)
Also https://github.com/metosin/ring-swagger/pull/129 @ikitommi
Although I can’t think of a good match for anyOf
and allOf
using schemas
Side question - is there an OpenAPI 3 planned for ring-swagger
? If yes, will it be spec
-only or also support plumatic schema
?
(my primary interest here is about generating clients
Is the there a list of changes between 2 and 3 somewhere?
Spec / Schema part is mostly about converting Spec or Schema to JSON Schema and I doubt that has changed much, if at all
Hmm, JSON-Schema uses oneOf
OpenAPI v2 doesn't mention this and v3 does use oneOf
for some cases, outside of JSON-Schema
Swagger2 JSON Schema is defined using oneOf, but does not support it: https://github.com/OAI/OpenAPI-Specification/issues/57
OpenApi3 support would be awesome, here's the issue: https://github.com/metosin/ring-swagger/issues/121
travis build failed - looks unrelated to the code changes though
No command 'lein2' found, did you mean:
Should be fixed in master
Alright - updated the pr and it passes validation - I am not sure however what is the purpose of "void"
almost a changelog 😛 https://github.com/OAI/OpenAPI-Specification/issues/333#issuecomment-283752631 the summary from this discussion: - swagger is a subset of json schema, and up until version 2 did not have oneOf, anyOf, allOf. I think for this version we should use x-oneOf x-anyOf - version 3 supports it so hopefully this will not be a question anymore when implementing openapi 3