RequestDefinition
Contract for an HTTP endpoint: method, path, optional input, and the structs that decode its bodies.
@defjs/core · Type
Signature
type RequestDefinition< TInput extends AnyStruct | undefined = undefined, TOutput extends AnyStruct | undefined = undefined, TError extends AnyStruct | undefined = undefined, > = ResponseDeclaration<TOutput, TError> & { builder?: OutboundBuilder; input?: TInput; method: string; operation?: string; path: string; };
Declaring input requires an explicit builder to place the parsed value on
the request. input only defines the parameters; the builder alone decides
where each value goes. Only definitions without input may omit builder.
output declares the body for a 2xx response, error the body for anything
else. Only one of the two ever runs, and omitting one means that body is never
read. ResponseDeclaration is an internal helper type: output and error
are required only when the matching type parameter is a struct. There is no
responseType: the struct kind selects how a declared body is read. Pass to
defineRequest to get a typed endpoint.
Members
Prop
Type
output? TOutput | undefinederror? TError | undefinedbuilder? OutboundBuilder | undefinedinput? TInput | undefinedmethod stringoperation? string | undefinedpath string