Hugs
Hugs is a normalization/denormalization library.
The main goal of this library is to provide tools to create data-contracts to work with applications written in non-BEAM programming languages.
For instance, a Java or PHP application may define data structures that we would like to represent as structs in Elixir. Such data may be sent to an Elixir application as JSON, XML or any other serialization format. Hugs helps to define functions that will take care of this data and cast it to an Elixir data structure.
Hugs does not handle deserialization as there are many libraries available for that. That means that one has to handle the deserialization by themselves.
The library is still a work in progress, nothing has been done on the normalization tools, there is only denormalization at the moment.
Example
some_json_string
|> Jason.decode!()
|> Hugs.denormalize!(
Hugs.build_props()
|> Hugs.field(:limit, type: :integer)
|> Hugs.field(:title, type: :binary)
|> Hugs.field(:query, type: :map)
)Installation
Hugs is available in Hex.
{:hugs, "~> 0.1.0"},
end