-
-
Save borkdude/ab0fa75773ab08bdcca0f4d5b74f2c63 to your computer and use it in GitHub Desktop.
Swagger problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sample.handler | |
(:require [org.httpkit.server :as server] | |
[plumbing.core :refer [defnk]] | |
[kekkonen.cqrs :refer :all] | |
[schema.core :as s])) | |
(s/defschema AnnotateNode | |
{(s/optional-key :node/text) s/Str | |
(s/optional-key :mode/unbound-mode?) s/Bool | |
s/Any s/Any}) | |
(s/defschema AnnotateUnstructuredQuery | |
{(s/optional-key :id) s/Str | |
(s/optional-key :text) s/Str | |
;; for classifier | |
(s/optional-key :article/tags) [s/Str] | |
;; for classifier | |
(s/optional-key :article/source) s/Str | |
(s/optional-key :version) s/Str | |
(s/optional-key :skip-classification) s/Bool | |
(s/optional-key :mode/unbound-mode?) s/Bool | |
(s/optional-key :document/nodes) [AnnotateNode] | |
(s/optional-key :response/filter) s/Any | |
s/Any s/Any}) | |
(defnk ^:command echo-pizza | |
"Echoes a pizza" | |
{:responses {:default {:schema Pizza}}} | |
[data :- AnnotateUnstructuredQuery] | |
(success data)) | |
(defnk ^:query hello [[:data name :- String]] | |
(success {:message (str "Hello, " name)})) | |
(def app (cqrs-api {:swagger {:ui "/api-docs" | |
:spec "/swagger.json" | |
:data {:info {:title "Kekkonen example"}}} | |
:core {:handlers {:hello #'hello | |
:pizza #'echo-pizza}}})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment