View Source ExNominatim.Validations (ExNominatim v1.1.4)

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

Show all fields and their explanations.

Given a request params struct (%ReverseParams{}, %SearchParams{}, etc.), a keyword list, or a list of atoms corresponding to keys, explain the fields, their default values (if any) and their values' limits (if applicable). It ignores any keyword list keys or atoms in the list that do not correspond to request parameters. If provided with the atom of a field, it returns the validation/explanation message for that field

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()

View Source (since 1.0.0)

Show all fields and their explanations.

Link to this function

explain_fields(x)

View Source (since 1.0.0)

Given a request params struct (%ReverseParams{}, %SearchParams{}, etc.), a keyword list, or a list of atoms corresponding to keys, explain the fields, their default values (if any) and their values' limits (if applicable). It ignores any keyword list keys or atoms in the list that do not correspond to request parameters. If provided with the atom of a field, it returns the validation/explanation message for that field

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.