Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Specification Extensions #11 #21

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
3 changes: 1 addition & 2 deletions src/Data/OpenApi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ module Data.OpenApi (
-- ** Miscellaneous
MimeList(..),
URL(..),
SpecificationExtensions(..),
) where

import Data.OpenApi.Lens
Expand Down Expand Up @@ -184,7 +185,6 @@ import Data.OpenApi.Internal
-- "title": "Todo API",
-- "version": "1.0"
-- }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the catch!

--
-- This can be useful for combining specifications of endpoints into a whole API specification:
--
Expand Down Expand Up @@ -412,7 +412,6 @@ import Data.OpenApi.Internal
-- ],
-- "type": "object"
-- }

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this empty line is crucial, it separates a new section "manipulation" from the previous one. please bring it back :)

-- $manipulation
-- Sometimes you have to work with an imported or generated @'Swagger'@.
-- For instance, <servant-swagger http://hackage.haskell.org/package/servant-swagger> generates basic @'Swagger'@
Expand Down
7 changes: 7 additions & 0 deletions src/Data/OpenApi/Aeson/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ lookupKey = KeyMap.lookup . Key.fromText

hasKey :: T.Text -> KeyMap.KeyMap a -> Bool
hasKey = KeyMap.member . Key.fromText

filterWithKey :: (Key -> v -> Bool) -> KeyMap.KeyMap v -> KeyMap.KeyMap v
filterWithKey = KeyMap.filterWithKey

#else
deleteKey :: T.Text -> HM.HashMap T.Text v -> HM.HashMap T.Text v
deleteKey = HM.delete
Expand Down Expand Up @@ -73,4 +77,7 @@ lookupKey = HM.lookup

hasKey :: T.Text -> HM.HashMap T.Text a -> Bool
hasKey = HM.member

filterWithKey :: (T.Text -> v -> Bool) -> HM.HashMap T.Text v -> HM.HashMap T.Text v
filterWithKey = HM.filterWithKey
#endif
Loading