ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.RouteDescription

Description

The documented operation view of a route, as plain OpenAPI-free data.

specsOf erases an Ecluse.Core.Server.Route.Route into the operations the OpenAPI spec needs. A write route contributes PUT, a submission route POST, and a removal route DELETE. A read route contributes both GET and its derived bodiless HEAD operation. The capture type, builder, and typed response value disappear. Each operation's ResponseDocs still come from the same ResponseContract runtime dispatch uses.

Synopsis

The documented view

data RouteSpec Source #

One served HTTP operation, as the manifest documents it. No Eq or Show: request and response schemas may carry autodocodec codecs, which are functions.

Constructors

RouteSpec 

Fields

data PathSeg Source #

One literal or captured path segment.

Constructors

Lit Text 
Param ParamSpec 

Instances

Instances details
Show PathSeg Source # 
Instance details

Defined in Ecluse.Core.Server.RouteDescription

Eq PathSeg Source # 
Instance details

Defined in Ecluse.Core.Server.RouteDescription

Methods

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

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

data ParamSpec Source #

A named path parameter and its human-facing description.

Constructors

ParamSpec 

Fields

Instances

Instances details
Show ParamSpec Source # 
Instance details

Defined in Ecluse.Core.Server.RouteDescription

Eq ParamSpec Source # 
Instance details

Defined in Ecluse.Core.Server.RouteDescription

Projection from a route

specsOf :: Route v -> [RouteSpec] Source #

Project a route to every exact method it serves. The HEAD contract is the bodilessContract reading of the response value GET uses, so its status set cannot drift from the GET's.

The synthetic catch-all

catchAllSpecs :: ResponseContract r -> ParamSpec -> NonEmpty RouteSpec Source #

The GET and HEAD pair documenting a mount's deny-by-default catch-all. It is the absence of a match rather than a route, so no Route carries it and each table appends it.

unsupportedPathParam :: ParamSpec Source #

The catch-all's path parameter, as every mount's route table documents it.