File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/Servant/OpenApi/Internal/TypeLevel Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -95,4 +95,17 @@ type family BodyTypes' c api :: [*] where
9595#if MIN_VERSION_servant(0,19,0)
9696 BodyTypes' c (NamedRoutes api) = BodyTypes' c (ToServantApi api)
9797#endif
98+ -- Handle UVerb by recursively expanding it to BodyTypes' c (Verb ...)
99+ -- Unwrap WithStatus explicitly to avoid trying to expand
100+ -- `Verb .. (WithStatus n a)` later on.
101+ BodyTypes' c (UVerb verb cs ((WithStatus n a) ': as)) =
102+ AppendList (BodyTypes' c (Verb verb (StatusOf a) cs a)) (BodyTypes' c (UVerb verb cs as))
103+ -- If we don't have a WithStatus wrapper, it might be 'NoContent' or
104+ -- some other type with a `HasStatus` instance. The catch-all will
105+ -- expand it to '[] if we can't extract a useful body type from it,
106+ -- so that's fine.
107+ BodyTypes' c (UVerb verb cs (a ': as)) =
108+ AppendList (BodyTypes' c (Verb verb (StatusOf a) cs a)) (BodyTypes' c (UVerb verb cs as))
109+ BodyTypes' c (UVerb verb cs '[] ) = '[]
110+
98111 BodyTypes' c api = '[]
You can’t perform that action at this time.
0 commit comments