Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The server is starting fine but the Swagger UI in the frontend is flashing an error #657

Open
Abrar-Ahmed7 opened this issue Nov 29, 2023 · 1 comment

Comments

@Abrar-Ahmed7
Copy link

Abrar-Ahmed7 commented Nov 29, 2023

After adding this middleware (io.pedestal.http.ring-middlewares/content-type {:mime-types {}}) along with

(pedestal/routing-interceptor
                         (reitit-http/router (routes)
                                             (reitit-router-config))
                         (ring/routes (swagger-ui/create-swagger-ui-handler
                                       {:path "/api-docs"
                                        :config {:validatorUrl nil
                                                 :operationsSorter "alpha"}})
                                      (ring/create-resource-handler)
                                      (ring/create-default-handler)))

to my ::http/interceptors of my service-map which is being used to create and start the server, the server is starting fine but the Swagger UI in the frontend is flashing an error like,

Parser error on line 2
unexpected end of the stream within a flow collection

And the response to the swagger endpoint/swagger.json returns,

{
    : swagger "2.0",
    : x-id#{
        : reitit.swagger/default
    },
    : info{
        : title "Export Service API",
        : description "with pedestal & reitit-http"
    },
    .
    .
    .
    <rest-of-the-json-data>
    .
 }

What would be the issue here? Can I overcome this in my code base itself?
Additional info:

  • Without this this middleware (io.pedestal.http.ring-middlewares/content-type {:mime-types {}}) everything working fine.
  • These are the dependencies I am using:
     [fi.metosin/reitit-malli "0.7.0-alpha6"]
     [fi.metosin/reitit-pedestal "0.7.0-alpha6"]
     [fi.metosin/reitit "0.7.0-alpha6"]
     [metosin/ring-swagger-ui "5.0.0-alpha.0"]
     [io.pedestal/pedestal.service "0.5.10"]
     [io.pedestal/pedestal.route "0.5.10"]
     [io.pedestal/pedestal.jetty "0.5.10"]
Screenshot 2023-11-29 at 9 23 17 PM Screenshot 2023-11-29 at 9 23 51 PM
@opqdonut
Copy link
Member

Looks like your like swagger.json is EDN instead of JSON. Maybe you're missing some content-negotiation or format middleware? I'm not familiar with pedestal so I can't help with that, but perhaps the pedestal-malli-swagger example will help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants