oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
525 stars 42 forks source link

Problem with absolute server URL in OpenAPI definition and martian-http/bootstrap-openapi #116

Closed tmatinla closed 2 years ago

tmatinla commented 3 years ago

I'm getting invalid URL when trying to use martian-http/bootstrap-openapi here:

(require '[martian.core :as martian]
         '[martian.clj-http :as martian-http])

(let [m (martian-http/bootstrap-openapi "https://api.severa.visma.com/rest-api/openapidocs/v0.2/doc.json")]
  (martian/url-for m :public-bearer-authentication-get-login-token))

; => "https://api.severa.visma.comhttps://api.severa.visma.com/rest-api/v0.2/token"
; expected "https://api.severa.visma.com/rest-api/v0.2/token"

I believe the problem is that martian-http/bootstrap-openapi expects the server URL to be relative in the definition?

oliyh commented 3 years ago

Hello,

Thanks for the report. Yes, there is a URL which it tries to parse inside the swagger doc which it obviously thinks is relative. Should be relatively simple to detect and fix.

oliyh commented 2 years ago

Hi, this should be fixed in #129 which is available in 0.1.21-SNAPSHOT, could you try?

Closing this issue, please reopen if the issue persists.

Thanks