ring-swagger

ring-swagger & compojure-api
ikitommi 2017-10-23T05:29:51.000153Z

@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?

ikitommi 2017-10-23T05:32:47.000066Z

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.

1😄
2017-10-23T11:29:58.000185Z

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)

2017-10-23T11:35:54.000147Z

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! 🙂

shem 2017-10-23T11:44:06.000330Z

https://ghadis.discendum.com/Rango-swagger.avi

shem 2017-10-23T11:44:39.000026Z

was watching Rango yesterday and noticed this perfect illustration of proper swagger.

ikitommi 2017-10-23T12:11:13.000044Z

@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.

ikitommi 2017-10-23T12:13:00.000162Z

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…

1
2017-10-23T16:49:37.000192Z

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

juhoteperi 2017-10-23T16:50:54.000351Z

Is the there a list of changes between 2 and 3 somewhere?

juhoteperi 2017-10-23T16:51:32.000458Z

Spec / Schema part is mostly about converting Spec or Schema to JSON Schema and I doubt that has changed much, if at all

juhoteperi 2017-10-23T16:54:45.000096Z

Hmm, JSON-Schema uses oneOf

juhoteperi 2017-10-23T16:55:04.000144Z

OpenAPI v2 doesn't mention this and v3 does use oneOf for some cases, outside of JSON-Schema

ikitommi 2017-10-23T16:55:29.000282Z

Swagger2 JSON Schema is defined using oneOf, but does not support it: https://github.com/OAI/OpenAPI-Specification/issues/57

ikitommi 2017-10-23T16:58:21.000618Z

OpenApi3 support would be awesome, here's the issue: https://github.com/metosin/ring-swagger/issues/121

1➕
2017-10-23T17:02:18.000077Z

travis build failed - looks unrelated to the code changes though

No command 'lein2' found, did you mean:

juhoteperi 2017-10-23T17:04:48.000433Z

Should be fixed in master

2017-10-23T17:06:01.000465Z

ah you were faster - thanks 🙂 - I’ll rebase

2017-10-23T17:12:37.000600Z

doh - did not realize you were using midje - I’ll need to make the test actually pass 😛

2017-10-23T21:21:27.000297Z

Alright - updated the pr and it passes validation - I am not sure however what is the purpose of "void"

2017-10-23T21:55:17.000184Z

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