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

Servant MultiVerb #1649

Merged
merged 26 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
016ec9b
metrics-wai: Simplify and generalise RoutesToPaths
pcapriotti Jul 9, 2021
c9f51f7
Introduce MultiVerb
pcapriotti Jul 8, 2021
4d8c0c0
Depend on servant-swagger fixes
pcapriotti Jul 9, 2021
8265ce8
Generate swagger for MultiVerb
pcapriotti Jul 9, 2021
2f57302
Convert GET user endpoints to MultiVerb
pcapriotti Jul 9, 2021
bde85dd
Add header support to MultiVerb
pcapriotti Jul 12, 2021
3491a43
Generalise AsUnion instance for Maybe a
pcapriotti Jul 12, 2021
56466b4
Add export list to MultiVerb
pcapriotti Jul 12, 2021
51550fb
Generate Swagger headers for MultiVerb
pcapriotti Jul 12, 2021
dcf38d2
Avoid duplicate Swagger `produces` entries
pcapriotti Jul 13, 2021
0bd5702
Content type mismatch should be fatal
pcapriotti Jul 13, 2021
6e8c569
Add haddocks for MultiVerb
pcapriotti Jul 13, 2021
0e75567
Reformat MultiVerb code
pcapriotti Jul 13, 2021
72b7563
Implement HasClient for MultiVerb
pcapriotti Jul 13, 2021
a8e9b3c
Update CHANGELOG
pcapriotti Jul 14, 2021
22eb69e
Merge remote-tracking branch 'origin/develop' into pcapriotti/multiverb
pcapriotti Jul 14, 2021
1659966
Refactor MultiVerb to make it more like UVerb
pcapriotti Jul 14, 2021
61b5ce3
Merge remote-tracking branch 'origin/develop' into pcapriotti/multiverb
pcapriotti Jul 15, 2021
aaebc03
Hi CI
pcapriotti Jul 16, 2021
dbf253a
Merge remote-tracking branch 'origin/develop'
pcapriotti Jul 19, 2021
3fc769d
Revert changes to GET user endpoints
pcapriotti Jul 19, 2021
d2fa599
Fix `MonadPlus` instance of `UnrenderResult`
pcapriotti Jul 19, 2021
6076b17
Use Haddock syntax and fix grammar
pcapriotti Jul 19, 2021
45f68c2
Improve naming and add docs to UnrenderResult
pcapriotti Jul 21, 2021
c9b84f4
Add note about lazyness of render outputs
pcapriotti Jul 21, 2021
eac09c1
Document AsUnion instances
pcapriotti Jul 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Upgrade nginz (#1658)

## Documentation

* Improved Swagger documentation for endpoints with multiple responses (#1649).

## Internal changes

* The servant-swagger dependency now points to the current upstream master (#1656).
Expand Down Expand Up @@ -103,6 +105,7 @@ This release requires a manual change in your galley configuration: `settings.co
* [Federation] Adjust scripts under ./hack/federation to work with recent changes to the federation API (#1632).
* Refactored Proteus endpoint to work with qualified users (#1634).
* Refactored Federator InternalServer (#1637)
* Introduced `MultiVerb` endpoints in Servant API (#1649).

### Internal Federation API changes

Expand Down
74 changes: 4 additions & 70 deletions libs/metrics-wai/src/Data/Metrics/Servant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ instance
where
getRoutes = [Node (Left (cs (":" <> symbolVal (Proxy @capture)))) (getRoutes @segs)]

-- route :> routes
-- route :<|> routes
instance
{-# OVERLAPPING #-}
( RoutesToPaths route,
Expand All @@ -107,79 +107,13 @@ instance
where
getRoutes = getRoutes @route <> getRoutes @routes

-- stuff to ignore
instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'HEAD status ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'GET status ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'POST status ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'PUT status ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'DELETE status ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (Verb 'PATCH status ctypes content) where
getRoutes = []

instance RoutesToPaths (NoContentVerb 'DELETE) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'HEAD ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'GET ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'POST ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'PUT ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'DELETE ctypes content) where
getRoutes = []

instance {-# OVERLAPPING #-} RoutesToPaths (UVerb 'PATCH ctypes content) where
getRoutes = []

instance RoutesToPaths Raw where
getRoutes = []

instance
{-# OVERLAPPING #-}
( RoutesToPaths segs
) =>
RoutesToPaths (ReqBody ctypes content :> segs)
where
getRoutes = getRoutes @segs

instance
{-# OVERLAPPING #-}
( KnownSymbol sym,
RoutesToPaths segs
) =>
RoutesToPaths (Header sym content :> segs)
where
getRoutes = getRoutes @segs

instance
{-# OVERLAPPING #-}
( KnownSymbol sym,
RoutesToPaths segs
) =>
RoutesToPaths (QueryParam sym content :> segs)
where
getRoutes = getRoutes @segs

instance
{-# OVERLAPPABLE #-}
( RoutesToPaths segs
) =>
RoutesToPaths (anything :> segs)
where
getRoutes = getRoutes @segs

instance {-# OVERLAPPABLE #-} RoutesToPaths anything where
getRoutes = []
3 changes: 3 additions & 0 deletions libs/wire-api/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ library:
- proto-lens
- QuickCheck >=2.14
- quickcheck-instances >=0.3.16
- resourcet
- saml2-web-sso
- servant
- servant-client
- servant-client-core
- servant-multipart
- servant-server
- servant-swagger
Expand Down
Loading