-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #673 from metosin/malli-vars
Generate correct OpenAPI $ref schemas for malli var and ref schemas
- Loading branch information
Showing
6 changed files
with
218 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,28 @@ | |
[reitit.ring.middleware.multipart :as multipart] | ||
[reitit.ring.middleware.parameters :as parameters] | ||
[ring.adapter.jetty :as jetty] | ||
[malli.core :as malli] | ||
[muuntaja.core :as m])) | ||
|
||
(def Transaction | ||
[:map | ||
[:amount :double] | ||
[:from :string]]) | ||
|
||
(def AccountId | ||
[:map | ||
[:bank :string] | ||
[:id :string]]) | ||
|
||
(def Account | ||
[:map | ||
[:bank :string] | ||
[:id :string] | ||
[:balance :double] | ||
[:transactions [:vector #'Transaction]]]) | ||
|
||
|
||
|
||
(def app | ||
(ring/ring-handler | ||
(ring/router | ||
|
@@ -89,8 +109,23 @@ | |
[:email {:json-schema/example "[email protected]"} | ||
string?]]]}}}} | ||
:handler (fn [_request] | ||
[{:name "Heidi" | ||
:email "[email protected]"}])}}] | ||
{:status 200 | ||
:body [{:name "Heidi" | ||
:email "[email protected]"}]})}}] | ||
|
||
["/account" | ||
{:get {:summary "Fetch an account | Recursive schemas using malli registry" | ||
:parameters {:query #'AccountId} | ||
:responses {200 {:content {:default {:schema #'Account}}}} | ||
:handler (fn [_request] | ||
{:status 200 | ||
:body {:bank "MiniBank" | ||
:id "0001" | ||
:balance 13.5 | ||
:transactions [{:from "0002" | ||
:amount 20.0} | ||
{:from "0003" | ||
:amount -6.5}]}})}}] | ||
|
||
["/secure" | ||
{:tags #{"secure"} | ||
|
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
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
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
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