reitit icon indicating copy to clipboard operation
reitit copied to clipboard

Rules are not correctly resolved to x-anyOf

Open danjohansson opened this issue 1 year ago • 2 comments

I think this transformation

  (malli.swagger/transform [:or int? string?])
  ;; => {:type "integer",
  ;;     :format "int64",
  ;;     :x-anyOf [{:type "integer", :format "int64"} {:type "string"}]}

should resolve to just {:x-anyOf [{:type "integer", :format "int64"} {:type "string"}]}

I get the same behaviour when using spec transforms with (s/or ..) constructs

danjohansson avatar Sep 12 '22 12:09 danjohansson

I think :x-anyOf is not official extension. Officially it's an integer. If you can point a documentation it should work differently, please share.

ikitommi avatar Sep 12 '22 14:09 ikitommi

Hi Reading my report again I realize that it may have come out the wrong way. It was not my intention to tell anyone how it should work. I just tried to be to the point. Sorry about that.

I assumed x-anyOf is intended to work like anyOf in OAS3. Documented here: https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ and here: https://spec.openapis.org/oas/v3.1.0#fixed-fields-20

/Dan

danjohansson avatar Sep 12 '22 16:09 danjohansson

We hope to support OpenAPI3 soon, so closing this.

ikitommi avatar Jan 10 '23 12:01 ikitommi