@@ -14,7 +14,7 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
14
14
15
15
[ ![ Clojars Project] ( http://clojars.org/metosin/compojure-api/latest-version.svg )] ( http://clojars.org/metosin/compojure-api )
16
16
17
- ** NOTE** All codes in ` master ` are already against the upcoming ` 1.0.0 ` . Wiki is for the latest stabile version .
17
+ ** NOTE** All codes in ` master ` are already against the upcoming ` 1.0.0 ` . Wiki is partially still for ` 0.24.5 ` .
18
18
19
19
## For information and help
20
20
@@ -47,25 +47,32 @@ Stuff on top of [Compojure](https://github.com/weavejester/compojure) for making
47
47
48
48
(s/defschema Pizza
49
49
{:name s/Str
50
+ (s/optional-key :description ) s/Str
50
51
:size (s/enum :L :M :S )
51
52
:origin {:country (s/enum :FI :PO )
52
53
:city s/Str}})
53
54
54
55
(defapi app
55
- {:swagger {:spec " /swagger.json"
56
- :ui " /api-docs"
57
- :data {:data {:info {:title " My Swagger API"
58
- :description " Compojure Api example" }
59
- :tags [{:name " api" , :description " sample api" }]}})
56
+ {:swagger
57
+ {:ui " /api-docs"
58
+ :spec " /swagger.json"
59
+ :data {:info {:title " Sample API"
60
+ :description " Compojure Api example" }
61
+ :tags [{:name " api" , :description " some apis" }]}}}
62
+
60
63
(context " /api" []
61
64
:tags [" api" ]
62
- (GET " /hello" []
63
- :query-params [name :- String]
64
- (ok {:message (str " Hello, " name)}))
65
- (POST " /pizza" []
65
+
66
+ (GET " /plus" []
67
+ :return {:result Long}
68
+ :query-params [x :- Long, y :- Long]
69
+ :summary " adds two numbers together"
70
+ (ok {:result (+ x y)}))
71
+
72
+ (POST " /echo" []
66
73
:return Pizza
67
74
:body [pizza Pizza]
68
- :summary " echoes a pizza "
75
+ :summary " echoes a Pizza "
69
76
(ok pizza))))
70
77
```
71
78
0 commit comments