From acbb52c7e52524eb0aa6753181790c21c9b0ec6c Mon Sep 17 00:00:00 2001 From: Ashley Yakeley Date: Fri, 19 Apr 2024 00:18:38 -0700 Subject: [PATCH] OpenAPI (#251): modules --- Pinafore/pinafore-webapi/lib/Pinafore/WebAPI.hs | 3 ++- .../pinafore-webapi/lib/Pinafore/WebAPI/Fetch.hs | 1 + .../pinafore-webapi/lib/Pinafore/WebAPI/OpenAPI.hs | 13 +++++++++++++ Pinafore/pinafore-webapi/package.yaml | 3 +++ Pinafore/pinafore-webapi/pinafore-webapi.cabal | 5 ++--- 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/Fetch.hs create mode 100644 Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/OpenAPI.hs diff --git a/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI.hs b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI.hs index 9cc79bde7..11ba1da7c 100644 --- a/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI.hs +++ b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI.hs @@ -3,6 +3,7 @@ module Pinafore.WebAPI ) where import Pinafore.Language +import Pinafore.WebAPI.OpenAPI webAPIImporters :: [Importer] -webAPIImporters = [] +webAPIImporters = [openAPIImporter] diff --git a/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/Fetch.hs b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/Fetch.hs new file mode 100644 index 000000000..c63607820 --- /dev/null +++ b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/Fetch.hs @@ -0,0 +1 @@ +module Pinafore.WebAPI.Fetch where diff --git a/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/OpenAPI.hs b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/OpenAPI.hs new file mode 100644 index 000000000..c0e0a4edd --- /dev/null +++ b/Pinafore/pinafore-webapi/lib/Pinafore/WebAPI/OpenAPI.hs @@ -0,0 +1,13 @@ +module Pinafore.WebAPI.OpenAPI + ( openAPIImporter + ) where + +import Pinafore.Language +import Pinafore.WebAPI.Fetch () +import Shapes + +importOpenAPI :: Text -> ResultT Text IO (LibraryContents ()) +importOpenAPI _t = liftInner $ FailureResult "NYI" + +openAPIImporter :: Importer +openAPIImporter = MkImporter "openapi" importOpenAPI diff --git a/Pinafore/pinafore-webapi/package.yaml b/Pinafore/pinafore-webapi/package.yaml index adb041534..53f429994 100644 --- a/Pinafore/pinafore-webapi/package.yaml +++ b/Pinafore/pinafore-webapi/package.yaml @@ -13,3 +13,6 @@ library: - pinafore-language exposed-modules: - Pinafore.WebAPI + other-modules: + - Pinafore.WebAPI.Fetch + - Pinafore.WebAPI.OpenAPI diff --git a/Pinafore/pinafore-webapi/pinafore-webapi.cabal b/Pinafore/pinafore-webapi/pinafore-webapi.cabal index a0168b921..580cfbed3 100644 --- a/Pinafore/pinafore-webapi/pinafore-webapi.cabal +++ b/Pinafore/pinafore-webapi/pinafore-webapi.cabal @@ -17,9 +17,8 @@ library exposed-modules: Pinafore.WebAPI other-modules: - Paths_pinafore_webapi - autogen-modules: - Paths_pinafore_webapi + Pinafore.WebAPI.Fetch + Pinafore.WebAPI.OpenAPI hs-source-dirs: lib default-extensions: