OapiCodemode.Proxy.Query (oapi_codemode v0.3.1)

Copy Markdown View Source

Serializes query parameters honoring the spec's style/explode declarations (the ele lesson: default serializers silently mismatch backend expectations). Supported: form (explode true/false), deepObject, spaceDelimited, pipeDelimited. Anything else falls back to form+explode.

nil-valued params are dropped entirely (never rendered as name=), as are empty arrays (dropped regardless of explode).

Non-scalar leaves that can't be represented (e.g. a nested map/list without a style that knows how to flatten it) are reported as {:error, message} rather than raising deep inside to_string/1 — that used to either crash (Protocol.UndefinedError) or silently corrupt the value (to_string/1 on a list of integers coerces through a charlist).

Summary

Functions

encode(params)

@spec encode([{String.t(), term(), map()}]) ::
  {:ok, String.t()} | {:error, String.t()}