Fork me on GitHub
#reitit
<
2021-03-09
>
mynomoto15:03:56
replied to a thread:

This is an interesting question, not sure of how smart the swagger generator can be.

juhoteperi17:03:31
replied to a thread:

Not sure if this was answered yet.

(json-schema/transform [:or {:json-schema/type "string"} int? string?]  )
  ;; => {:anyOf [{:type "integer", :format "int64"} {:type "string"}],
  ;;     :type "string"}
Though in this case [:maybe string?] would be more precise than :or. But not sure if it works any better with SwaggerUI. :or generates anyOf json-schema, :maybe generates oneOf.

👍 2