JSV.Normalizer.Normalize protocol (jsv v0.21.2)

Copy Markdown View Source

Protocol used by JSV.Normalizer to transform structs into JSON-compatible data structures when normalizing a schema.

When implementing this protocol you do not need to run any specific normalization by yourself, but rather just return a map with all or a selection of keys. Keys can be atoms or binaries, and values will be normalized recursively.

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns a JSON-compatible representation of the given term. Maps returned from this function can have atom or binary keys and their values are normalized recursively.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

normalize(t)

@spec normalize(term()) :: term()

Returns a JSON-compatible representation of the given term. Maps returned from this function can have atom or binary keys and their values are normalized recursively.