View Source ExNominatim.Validations (ExNominatim v1.0.0)

Functions used for the automatic validation of the keys of a request parameters struct according to the target endpoint, their values according to the API endpoint's specification, and invalidate any request parameters with confusing intent that might have unexpected results, such as defining both the :q free-form query parameter and at least one of the parameters of a structured query (:city, :country, etc.).

Summary

Functions

Given a request params struct (%ReverseParams{}, %SearchParams{}, etc.) explain its fields, their default values (if any) and their values' limits (if applicable).

Sanitizes the values of those fields of the params request params struct (%SearchParams{}, %ReverseParams{}, etc.) that contain a comma-separated list of strings according to the Nominatim API specification. It collapses all spaces and trims and leading and trailing commas.

Validates the content and intent of a request represented by a request parameters struct params (%SearchParams{}, %ReverseParams{}, etc.).

Functions

Link to this function

explain_fields(params)

View Source (since 1.0.0)

Given a request params struct (%ReverseParams{}, %SearchParams{}, etc.) explain its fields, their default values (if any) and their values' limits (if applicable).

Link to this function

sanitize_comma_separated_strings(params)

View Source (since 1.0.0)

Sanitizes the values of those fields of the params request params struct (%SearchParams{}, %ReverseParams{}, etc.) that contain a comma-separated list of strings according to the Nominatim API specification. It collapses all spaces and trims and leading and trailing commas.

You can use this function directly if you want to combine it with ExNominatim.Validations.validate/1.

Link to this function

validate(params)

View Source (since 1.0.0)

Validates the content and intent of a request represented by a request parameters struct params (%SearchParams{}, %ReverseParams{}, etc.).

You can use this function directly if you want to combine it with ExNominatim.HTTP.prepare/3.