<commit_before># Cactus

Library for conversion between [GPB](https://developers.google.com/protocol-buffers/) instance and Scala case class.

## GPB to case class

As we use [GPB](https://developers.google.com/protocol-buffers/)s for communication over the network, we quite often need to map the GPB to our business
object, which is usually a case class. We follow Google recommendations and have all fields `optional`, which is quite not handy when doing the business 
object mapping because some validation is necessary.  

This library solves both problems together - it generates conversion code (using macros) which is reading data from the GPB instance and putting them into the
case class and
depending on case class fields types it does automatic conversion (primitive types, collections) and also the validation - fields not wrapped in `Option` are
considered to be required and their absence causes failure of the conversion.

Currently there is only one possible conversion failure - `MissingFieldFailure`, which contains name of missing field.

It's common that the field has different name in the GPB than we want to have in the case class. This is solved with `GpbName` annotation - see
the example.
<commit_msg>test results badge in readme<commit_after># Cactus

[![Build Status](https://travis-ci.org/avast/cactus.svg?branch=master)](https://travis-ci.org/avast/cactus)
Library for conversion between [GPB](https://developers.google.com/protocol-buffers/) instance and Scala case class.

## GPB to case class

As we use [GPB](https://developers.google.com/protocol-buffers/)s for communication over the network, we quite often need to map the GPB to our business
object, which is usually a case class. We follow Google recommendations and have all fields `optional`, which is quite not handy when doing the business 
object mapping because some validation is necessary.  

This library solves both problems together - it generates conversion code (using macros) which is reading data from the GPB instance and putting them into the
case class and
depending on case class fields types it does automatic conversion (primitive types, collections) and also the validation - fields not wrapped in `Option` are
considered to be required and their absence causes failure of the conversion.

Currently there is only one possible conversion failure - `MissingFieldFailure`, which contains name of missing field.

It's common that the field has different name in the GPB than we want to have in the case class. This is solved with `GpbName` annotation - see
the example.

{'fraction_non_alphanumeric': 0.05583559519193486, 'fraction_numerical': 0.0, 'mean_word_length': 4.758928571428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3030911', 'n_tokens_mistral': 626, 'n_tokens_neox': 611, 'n_words': 356}