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

Is it possible to use a file:// url for the openapi deifinition? #174

Closed jave closed 1 year ago

jave commented 1 year ago

I tried this, but it didn seem to work: (let [m (martian-http/bootstrap-openapi "file:///api.yaml")] )

I wanted to use this api definition, but martian gives an exception https://api.mangadex.org/docs/static/api.yaml

So i would like to bisect the api file locally.

oliyh commented 1 year ago

Hi,

I have made this possible in #175

It's now documented in the README:

Note that when calling bootstrap-openapi you can also provide a url to a local resource, e.g. (martian-http/bootstrap-openapi "public/openapi.json"). For ClojureScript the file can only be read at compile time, so a slightly different form is required using the martian.file/load-local-resource macro:

(martian/bootstrap-openapi "https://sandbox.example.com" (load-local-resource "openapi-test.json") martian-http/default-opts)
oliyh commented 1 year ago

Available now on Clojars in 0.1.23-SNAPSHOT, I'd be interested in your feedback