Spectral.Codec.MapSet (Spectral v0.17.0)

Copy Markdown View Source

Built-in codec for MapSet.t() and MapSet.t(elem).

Encodes MapSet structs to JSON arrays and decodes JSON arrays back to MapSet. The resulting JSON array reflects the unordered nature of sets — duplicate entries that may appear in the decoded list are collapsed.

For MapSet.t(elem), each element is recursively encoded/decoded according to its type. For MapSet.t(), elements are passed through as-is.

Registration

Registered automatically when the :spectral application starts. To use a different codec for MapSet.t(), set it in config :spectra, :codecs; user-configured codecs take precedence over the built-ins.