This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-18
Channels
- # adventofcode (18)
- # announcements (1)
- # asami (99)
- # babashka (4)
- # beginners (45)
- # calva (20)
- # cider (44)
- # cljdoc (5)
- # clojure (66)
- # clojure-australia (2)
- # clojure-europe (36)
- # clojure-nl (11)
- # clojure-norway (4)
- # clojure-seattle (1)
- # clojure-uk (88)
- # clojurescript (37)
- # community-development (8)
- # conjure (8)
- # datascript (4)
- # datomic (29)
- # depstar (12)
- # emacs (7)
- # events (1)
- # fulcro (29)
- # graalvm (4)
- # graphql (2)
- # helix (2)
- # integrant (4)
- # jobs (7)
- # jobs-discuss (1)
- # lsp (3)
- # malli (6)
- # off-topic (61)
- # pathom (67)
- # pedestal (3)
- # re-frame (9)
- # reitit (4)
- # remote-jobs (13)
- # reveal (18)
- # shadow-cljs (59)
- # spacemacs (1)
- # sql (7)
- # startup-in-a-month (1)
- # tools-deps (29)
- # vim (12)
hiya, is there a way to overwrite the index.html
that reitit-swagger-ui
uses, or do I need to use ring-swagger-ui
to do that?
I’ve added an index.html to a swagger-ui
dir in resources
but it’s not picked up automatically so wondering what I’ve missed hooking up. (I’m new to reitit and pretty new to clojure too).
I want to have more control over the styling and header/footer of the docs site for a reitit API
Thanks!
swagger-ui/index.html
in the local project SHOULD precede one from the library. Did you have the resources
folder before or did you create it for this case? JVM might not pick up the folder before restarting lein
(or whatever tool you are using) if you created the folder only now.
Reitit swagger-ui doesn't anyway do anything special to serve the file, so you could also create our own handler to serve the index file. create-swagger-ui-handler
is usually used as default handler, so if you handle the swagger-ui index on your routes, it wouldn't even see the request.
hmmm interesting. I did already have a /resources
dir and I’m usings deps and integrant. I’ve restarted the whole project just in case but it doesn’t seem to be picking the index file.
Do you have an example of what to pass to create-swagger-ui-handler
to serve the index file from resources? Currently my project is wired up via integrant ig/refs passing opts of
{:path "/my-api"
:url "/my-api/swagger.json"}
though to (swagger-ui/create-swagger-ui-handler opts)
Reading through the docs of create-swagger-ui-handler
and the linked config explanation I just don’t quite understand it well enough to know how to adjust it to have control of the index templateI’ve changed the dirname in my resources folder, and included that in my opts map as root
and that seems to have done it.
I’ve grabbed the whole dist
directory from https://github.com/swagger-api/swagger-ui/tree/master/dist for the time being
swagger-ui/index.html
in the local project SHOULD precede one from the library. Did you have the resources
folder before or did you create it for this case? JVM might not pick up the folder before restarting lein
(or whatever tool you are using) if you created the folder only now.
Reitit swagger-ui doesn't anyway do anything special to serve the file, so you could also create our own handler to serve the index file. create-swagger-ui-handler
is usually used as default handler, so if you handle the swagger-ui index on your routes, it wouldn't even see the request.