In the below example, how can I set a default value for the path parameter item-id?
(POST "/:id" [item-id]
:path-params [item-id :- Int]
:body [body Body]
:query-params [{item-name :- Str nil}]
:summary "Create or update a…
I am trying to integrate compojure-api (version 1.1.12) into an existing compojure-based application. While most things work, I am having an issue with request coercions on an existing REST call whose usage would be difficult to change at this…
I'm trying to figure out how to do custom coercion with compojure-api and spec. By reading the docs and code I have been able to do coercion on the input (the body) but am unable to do coercion on the response body.
Specifically, I have a custom…
I am able to read RAW JSON of Post Request. But Not sure that I am doing it in right way or not?
CODE
(ns clojure-dauble-business-api.core
(:require [compojure.api.sweet :refer :all]
[ring.util.http-response :refer :all]
…
compojure-api allows you to define the return schema:
(s/defschema Pizza
{:name s/Str})
(GET "/pizza/:id" [id]
:return Pizza
:summary "returns a Pizza"
(ok (get-pizza id)))
My issue is when the get-pizza fn returns a 404 {:status 404 :body…
From the docs compojure-api... Given
(s/defschema Pizza
{:name s/Str
:size (s/enum :L :M :S)
:origin {:country (s/enum :FI :PO)
:city s/Str}})
You can later in your code do something like:
(defapi app
...
...
(POST* "/pizza" []
…