Skip to content

Commit

Permalink
plutus-pab: Adds Swagger support for web-server API (#3807)
Browse files Browse the repository at this point in the history
* Add swagger support via openapi3

Co-authored-by: Danil Berestov <GooseDB@yandex.ru>
  • Loading branch information
kelizarov and goosedb committed Sep 23, 2021
1 parent a3697f0 commit ba62878
Show file tree
Hide file tree
Showing 58 changed files with 362 additions and 77 deletions.
3 changes: 3 additions & 0 deletions marlowe/marlowe.cabal
Expand Up @@ -124,6 +124,7 @@ test-suite marlowe-test-long-running
http-client -any,
websockets -any,
network -any,
openapi3 -any,

test-suite marlowe-test
import: lang
Expand Down Expand Up @@ -168,6 +169,7 @@ test-suite marlowe-test
http-client -any,
websockets -any,
network -any,
openapi3

-- | The PAB Specialised to the marlowe contract(s)
executable marlowe-pab
Expand All @@ -192,5 +194,6 @@ executable marlowe-pab
plutus-tx -any,
purescript-bridge -any,
marlowe -any,
openapi3,
if !(impl(ghcjs) || os(ghcjs))
build-depends: plutus-tx-plugin -any
3 changes: 2 additions & 1 deletion marlowe/pab/MarloweContract.hs
Expand Up @@ -11,6 +11,7 @@ module MarloweContract(MarloweContract(..), handlers) where
import Control.Monad.Freer (interpret)
import Data.Aeson (FromJSON, ToJSON)
import Data.Default (Default (def))
import qualified Data.OpenApi as OpenApi
import Data.Text.Prettyprint.Doc (Pretty (..), viaShow)
import GHC.Generics (Generic)
import qualified Language.Marlowe.Client as Marlowe
Expand All @@ -27,7 +28,7 @@ data MarloweContract =
| WalletCompanion -- Wallet companion contract
| MarloweFollower -- Follower contract
deriving (Eq, Ord, Show, Read, Generic)
deriving anyclass (ToJSON, FromJSON)
deriving anyclass (ToJSON, FromJSON, OpenApi.ToSchema)

instance Pretty MarloweContract where
pretty = viaShow
Expand Down
3 changes: 3 additions & 0 deletions nix/pkgs/haskell/materialized-darwin/.plan.nix/marlowe.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions nix/pkgs/haskell/materialized-darwin/.plan.nix/plutus-pab.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba62878

Please sign in to comment.