servant-routes-0.1.0.0: Generate route descriptions from Servant APIs
Copyright(c) Frederick Pringle 2025
LicenseBSD-3-Clause
Maintainerfreddyjepringle@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Servant.API.Routes.Path

Description

Simple representation of URL paths.

Synopsis

Documentation

data Path Source #

Simple representation of a URL path.

Instances

Instances details
ToJSON Path Source # 
Instance details

Defined in Servant.API.Routes.Internal.Path

Show Path Source # 
Instance details

Defined in Servant.API.Routes.Internal.Path

Eq Path Source # 
Instance details

Defined in Servant.API.Routes.Internal.Path

Methods

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

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

Ord Path Source # 
Instance details

Defined in Servant.API.Routes.Internal.Path

prependPathPart :: Text -> Path -> Path Source #

Prepend a simple text path part to an API path.

For example, prependPathPart "api" will transform /v2/users to /api/v2/users.

prependCapturePart :: forall a. Typeable a => Text -> Path -> Path Source #

Prepend a capture path part of a given type to an API path. Equivalent to Capture name a :>.

For example, prependCapturePart @Int "id" will transform /detail to /<Int>/detail.

prependCaptureAllPart :: forall a. Typeable a => Text -> Path -> Path Source #

Prepend a capture-all path part of a given type to an API path. Equivalent to CaptureAll name a :>.

For example, prependCaptureAllPart @Int "id" will transform /detail to /<[Int]>/detail.

renderPath :: Path -> Text Source #

Pretty-print a path, including the leading /.