Questions tagged [compojure-api]

Stuff on top of Compojure for making sweet web apis.

You can read more about it at https://github.com/metosin/compojure-api

51 questions
0
votes
2 answers

How do I set default values for path parameters?

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…
Freid001
  • 2,580
  • 3
  • 29
  • 60
0
votes
1 answer

Compojure-api: Request coercion for a map supplied via multipart-params

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…
Eric Schoen
  • 668
  • 9
  • 16
0
votes
1 answer

compojure-api spec coercion on response body

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…
Ben Mabey
  • 1,269
  • 10
  • 18
0
votes
2 answers

Clojure, Compojure: Reading Post Request RAW Json

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] …
Srini
  • 823
  • 5
  • 10
  • 29
0
votes
1 answer

compojure-api return value schema or error

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…
kittyminky
  • 478
  • 6
  • 27
0
votes
1 answer

In Compojure-api how can I apply schema validation to the form-params of a particular route?

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" [] …
Naruto Sempai
  • 6,233
  • 8
  • 35
  • 51
1 2 3
4