OCSF.Deserializer (OCSF v0.1.0)

Copy Markdown View Source

Deserialization from OCSF-compliant nested maps back to structs.

Reconstructs an %OCSF.Event{} from the map shape OCSF.to_map/1 produces. Resolves _name strings back to UIDs via enum modules.

Prefer OCSF.Event.from_map/1 over calling this module directly.

See OCSF.Serializer, OCSF.Event.

Summary

Functions

Reconstruct an %OCSF.Event{} from a nested OCSF map.

Functions

from_map(map)

@spec from_map(map()) :: {:ok, OCSF.Event.t()} | {:error, OCSF.Error.t()}

Reconstruct an %OCSF.Event{} from a nested OCSF map.

Accepts both atom-keyed and string-keyed maps (e.g. from Jason.decode!/1). Runs OCSF.validate/1 after construction.