The server is starting fine but the Swagger UI in the frontend is flashing an error
Abrar-Ahmed7 opened this issue · comments
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](https://private-user-images.githubusercontent.com/90377366/286656588-841eb0d4-c759-4022-8687-25ef595f2379.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwMjM1MDAsIm5iZiI6MTcyMDAyMzIwMCwicGF0aCI6Ii85MDM3NzM2Ni8yODY2NTY1ODgtODQxZWIwZDQtYzc1OS00MDIyLTg2ODctMjVlZjU5NWYyMzc5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDE2MTMyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThkZDBhMDczY2RhYTRkY2YzYzEzMmU2MGVjMGZjMTI1YWFjY2VkMTJmMjMyNDdhZWI0NDQ0OGNmYzIxYjYwZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kC7sE0PmNtbbablz0Vth7r0Ur-L8KgkoGvjLcizXwXw)
![Screenshot 2023-11-29 at 9 23 51 PM](https://private-user-images.githubusercontent.com/90377366/286656603-3e3273f4-d65e-4272-8e94-7891ab5f69db.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwMjM1MDAsIm5iZiI6MTcyMDAyMzIwMCwicGF0aCI6Ii85MDM3NzM2Ni8yODY2NTY2MDMtM2UzMjczZjQtZDY1ZS00MjcyLThlOTQtNzg5MWFiNWY2OWRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDE2MTMyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNhYWMwYjNlNDY3ZmVhZjZiYmMyNWViYzc4YTZjMTI2ZGM2NGYzNjNiMTVkZGE0Yjk3ZmM3Y2E4ODdiOTVhYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.i8UHCJhzXpVUKkh_tohpfXRk1JzA6x0Q7jT-RhsUTwo)
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.