Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data JordanJSON
- data ReportingRequestBody a
- data JordanQuery' (baseStr :: Symbol) (options :: [*]) (a :: *)
- type RequiredJordanQuery (baseStr :: Symbol) (a :: *) = JordanQuery' baseStr '[Required] a
- type OptionalJordanQuery (baseStr :: Symbol) (a :: *) = JordanQuery' (baseStr :: Symbol) '[] (a :: *)
- newtype ViaJordan a = ViaJordan {
- getViaJordan :: a
Documentation
data JordanJSON Source #
Servant content type that lets you render or parse via Jordan.
Note: It is generally better to use ViaJordan
instead, which gets you nice API documentation.
However, you might want to slowly migrate your API to Jordan.
In this case, you can use this as a content type.
Instances
Accept JordanJSON Source # | Jordan JSON will have a content type of |
Defined in Jordan.Servant contentType :: Proxy JordanJSON -> MediaType # | |
ToJSON a => MimeRender JordanJSON a Source # | Uses |
Defined in Jordan.Servant mimeRender :: Proxy JordanJSON -> a -> ByteString # | |
FromJSON a => MimeUnrender JordanJSON a Source # | Parses directly from a lazy bytestring via Attoparsec |
Defined in Jordan.Servant mimeUnrender :: Proxy JordanJSON -> ByteString -> Either String a # mimeUnrenderWithType :: Proxy JordanJSON -> MediaType -> ByteString -> Either String a # |
data ReportingRequestBody a Source #
A parameter for use with Servant, which lets you parse the request body or report parse errors to the user. It is different from using the existing ReqBody param from Servant in that it will give a detailed report of why the format of the request body was wrong if need be.
This will use parseJSONReporting
for its work.
This is generally a little slower than direct attoparsec parsing, but avoids us having to parse twice.
Instances
HasLink sub => HasLink (ReportingRequestBody a :> sub :: Type) Source # | |
Defined in Jordan.Servant type MkLink (ReportingRequestBody a :> sub) a # toLink :: (Link -> a0) -> Proxy (ReportingRequestBody a :> sub) -> Link -> MkLink (ReportingRequestBody a :> sub) a0 # | |
type MkLink (ReportingRequestBody a :> sub :: Type) r Source # | |
Defined in Jordan.Servant |
data JordanQuery' (baseStr :: Symbol) (options :: [*]) (a :: *) Source #
A query argument at some key, that will be parsed via Jordan. If the query needs to contain nested data, it will all be nested under the same key.
We do not support lenient queries as figuring out what to return in the case where the Jordan parser would have parsed nested keys is too difficult.
Note: this type *does not* have a HasLink
instance, because unfortunately Servant is way too restrictive of what it exports,
making such an instance impossible to write. I will open up a PR against Servant to fix this soon.
type RequiredJordanQuery (baseStr :: Symbol) (a :: *) = JordanQuery' baseStr '[Required] a Source #
A query argument that is required.
Will render an error message, in JSON format, if the query was bad in some way.
type OptionalJordanQuery (baseStr :: Symbol) (a :: *) = JordanQuery' (baseStr :: Symbol) '[] (a :: *) Source #
A query argument that is *optional*.
Will render an error message, in JSON format, if the query was bad in some way.
Wrapper to perform JSON serialization via Jordan.
Types used with this wrapper should have isomorphic ToJSON
and FromJSON
instances.
A utility is provided to check this.
ViaJordan | |
|