object

# `http_parameters`

Typed HTTP query, form, path, header, and cookie parameter extraction helpers plus OpenAPI descriptor generation helpers.

Availability:
`logtalk_load(http_parameters(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-07-14
Compilation flags:
`static, context_switching_calls`
Imports:
`public` http_json_term_helpers
Uses:
http_core
list
type
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `parameters/3`

Extracts typed parameters from a normalized HTTP request using the given declaration list. Client-input failures throw `error(http_parameter_validation(Errors), Context)` where `Errors` is a non-empty list of structured parameter errors.

Compilation flags:
`static`
Template:
`parameters(Request,Declarations,Parameters)`
Mode and number of proofs:
`parameters(+compound,+list(compound),-list(compound))` - `one_or_error`
Exceptions:
`Request` is not a valid normalized HTTP request term:
`domain_error(http_request,Request)`
`Declarations` is a variable or a partial list:
`instantiation_error`
`Declarations` is neither a variable nor a list:
`type_error(list,Declarations)`
An element `Declaration` of the list `Declarations` is not a valid HTTP parameter declaration:
`domain_error(http_parameter_declaration,Declaration)`
An element `Declaration` of the list `Declarations` has an invalid parameter name:
`domain_error(http_parameter_name,Name)`
An element `Declaration` of the list `Declarations` has an invalid parameter source:
`domain_error(http_parameter_source,Source)`
An element `Declaration` of the list `Declarations` has an invalid parameter type:
`domain_error(http_parameter_type,Type)`
An element `Declaration` of the list `Declarations` has duplicated declaration options:
`domain_error(http_parameter_options,duplicate(Option))`
An element `Declaration` of the list `Declarations` has an invalid declaration option:
`domain_error(http_parameter_option,Option)`
An element `Declaration` of the list `Declarations` has an invalid description:
`domain_error(http_parameter_description,Description)`
An element `Declaration` of the list `Declarations` has an invalid default value:
`domain_error(http_parameter_default(Type),invalid_default(Name,Value))`
`Declarations` contains duplicated declarations for a parameter source:
`domain_error(http_parameter_declaration(Name,Source),duplicate)`
The request parameters fail declared type or constraint validation:
`error(http_parameter_validation(Errors),Context)`

### `parameter/3`

Extracts a single typed parameter from a normalized HTTP request using the given declaration. Optional absent parameters fail instead of throwing an error.

Compilation flags:
`static`
Template:
`parameter(Request,Declaration,Value)`
Mode and number of proofs:
`parameter(+compound,+compound,-term)` - `zero_or_one`

### `open_api_parameters/2`

Generates OpenAPI `parameter/5` descriptors for query, path, header, and cookie declarations.

Compilation flags:
`static`
Template:
`open_api_parameters(Declarations,Parameters)`
Mode and number of proofs:
`open_api_parameters(+list(compound),-list(compound))` - `one_or_error`
Exceptions:
`Declarations` is a variable or a partial list:
`instantiation_error`
`Declarations` is neither a variable nor a list:
`type_error(list,Declarations)`
An element `Declaration` of the list `Declarations` is not a valid HTTP parameter declaration:
`domain_error(http_parameter_declaration,Declaration)`
An element `Declaration` of the list `Declarations` has an invalid parameter name:
`domain_error(http_parameter_name,Name)`
An element `Declaration` of the list `Declarations` has an invalid parameter source:
`domain_error(http_parameter_source,Source)`
An element `Declaration` of the list `Declarations` has an invalid parameter type:
`domain_error(http_parameter_type,Type)`
An element `Declaration` of the list `Declarations` has an invalid declaration option:
`domain_error(http_parameter_option,Option)`
An element `Declaration` of the list `Declarations` has duplicated declaration options:
`domain_error(http_parameter_options,duplicate(Option))`
`Declarations` contains duplicated declarations for a parameter source:
`domain_error(http_parameter_declaration(Name,Source),duplicate)`

### `open_api_request_body/3`

Generates an OpenAPI `request_body/3` descriptor for form declarations using the given description. Fails when the declaration list contains no form parameters.

Compilation flags:
`static`
Template:
`open_api_request_body(Declarations,Description,RequestBody)`
Mode and number of proofs:
`open_api_request_body(+list(compound),+atom,-compound)` - `zero_or_one`

### `open_api_bad_request_response/1`

Returns the default OpenAPI `400 Bad Request` response descriptor used by router integrations.

Compilation flags:
`static`
Template:
`open_api_bad_request_response(Response)`
Mode and number of proofs:
`open_api_bad_request_response(-compound)` - `one`

## Protected predicates

(no local declarations; see entity ancestors if any)

## Private predicates

(no local declarations; see entity ancestors if any)

## Operators

(none)