servant-lint-0.1.0.0: Lint Servant Routes
Safe HaskellSafe-Inferred
LanguageGHC2021

Servant.Lint

Synopsis

Documentation

lintAPI :: forall api. Lintable api => IO () Source #

Pass your API type for lint errors thrown in IO This is typically useful for testing

lintAPI' :: forall api. Lintable api => [Error] Source #

Pass your API type for lint errors as Chunks Chunks are colored terminal bits from Text.Colour for making pretty errors.

printLintAPI :: forall api. Lintable api => IO () Source #

Pass your API type for lint via putStrLn in stdout

newtype Error Source #

Pretty errors via Text.Colour

Constructors

Error 

Fields

Instances

Instances details
Monoid Error Source # 
Instance details

Defined in Servant.Lint

Methods

mempty :: Error #

mappend :: Error -> Error -> Error #

mconcat :: [Error] -> Error #

Semigroup Error Source # 
Instance details

Defined in Servant.Lint

Methods

(<>) :: Error -> Error -> Error #

sconcat :: NonEmpty Error -> Error #

stimes :: Integral b => b -> Error -> Error #

Show Error Source # 
Instance details

Defined in Servant.Lint

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Eq Error Source # 
Instance details

Defined in Servant.Lint

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

data Path Source #

A term level representation of the API Its defined recursive to flatten the API to a list of routes instead of a tree

Instances

Instances details
Show Path Source # 
Instance details

Defined in Servant.Lint

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

Eq Path Source # 
Instance details

Defined in Servant.Lint

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Ord Path Source # 
Instance details

Defined in Servant.Lint

Methods

compare :: Path -> Path -> Ordering #

(<) :: Path -> Path -> Bool #

(<=) :: Path -> Path -> Bool #

(>) :: Path -> Path -> Bool #

(>=) :: Path -> Path -> Bool #

max :: Path -> Path -> Path #

min :: Path -> Path -> Path #

class Lintable a where Source #

The Lintable type class describes how to go from a Servant Combinator to a Path This is essentially a function from `Type -> [Path]` If you have custom Servant Combinators you may need to add an instance of Lintable for your Combinator, typically ignoring the custom Combinator.

Methods

paths :: [Path] Source #

Instances

Instances details
(Lintable a, Lintable b) => Lintable (a :<|> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

ReflectMethod method => Lintable (NoContentVerb method) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(KnownSymbol a, Lintable b) => Lintable (a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Lintable b, KnownSymbol hint, Typeable a) => Lintable (Capture' _mods hint a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Lintable b, KnownSymbol hint, Typeable a) => Lintable (CaptureAll hint a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Lintable b, KnownSymbol hint, Typeable a) => Lintable (QueryParam hint a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Lintable b, KnownSymbol hint, Typeable a) => Lintable (QueryParams hint a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Lintable b, Typeable a) => Lintable (ReqBody' _mods _ms a :> b) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

(Typeable ret, ReflectMethod method, KnownNat code) => Lintable (Verb method code _cs ret) Source # 
Instance details

Defined in Servant.Lint

Methods

paths :: [Path] Source #

data Ambiguity Source #

This is a striped down version of the Path focusing on removing details that ambiguate routes

Instances

Instances details
Generic Ambiguity Source # 
Instance details

Defined in Servant.Lint

Associated Types

type Rep Ambiguity :: Type -> Type #

Show Ambiguity Source # 
Instance details

Defined in Servant.Lint

Eq Ambiguity Source # 
Instance details

Defined in Servant.Lint

Ord Ambiguity Source # 
Instance details

Defined in Servant.Lint

type Rep Ambiguity Source # 
Instance details

Defined in Servant.Lint

unlinesChunks :: [[Chunk]] -> [Chunk] Source #

Exported for testing only