com.github.plokhotnyuk.jsoniter_scala.macros
Members list
Type members
Classlikes
Configuration parameter for JsonCodecMaker.make()
call.
Configuration parameter for JsonCodecMaker.make()
call.
BEWARE: a parameter of the make
macro should not depend on code from the same compilation module where it is called. Use a separated submodule of the project to compile all such dependencies before their usage for generation of codecs.
Examples of fieldNameMapper
, javaEnumValueNameMapper
, and adtLeafClassNameMapper
functions that have no dependencies in the same compilation module are: JsonCodecMaker.enforceCamelCase
, JsonCodecMaker.enforce_snake_case
, JsonCodecMaker.enforce-kebab-case
, and JsonCodecMaker.simpleClassName
. Or their composition like: s => JsonCodecMaker.enforce_snake_case(JsonCodecMaker.simpleClassName(s))
Value parameters
- adtLeafClassNameMapper
-
the function of mapping from string of case class/object full name to string value of discriminator field (a function that truncate to simple class name by default)
- allowRecursiveTypes
-
a flag that turns on support of recursive types (turned off by default to avoid stack overflow errors with untrusted input)
- alwaysEmitDiscriminator
-
a flag that causes the discriminator field and value to always be serialized, even when the codec derived is for an ADT leaf class and not the ADT base class. Note that this flag has no effect on generated decoders -- that is this flag does NOT cause decoders to start requiring the discriminator field when they are not strictly necessary
- bigDecimalDigitsLimit
-
an exclusive limit for accepted number of mantissa digits of to be parsed before rounding with the precision specified for 'BigDecimal' values (308 by default, don't set too big limit to avoid of OOM errors or attacks from untrusted input)
- bigDecimalPrecision
-
a precision in 'BigDecimal' values (34 by default that is a precision for decimal128, see
java.math.MathContext.DECIMAL128.getPrecision
, don't set too big or infinite precision to avoid attacks from untrusted input) - bigDecimalScaleLimit
-
an exclusive limit for accepted scale in 'BigDecimal' values (6178 by default that is a range for decimal128, don't set too big scale limit to avoid attacks from untrusted input)
- bigIntDigitsLimit
-
an exclusive limit for accepted number of decimal digits in 'BigInt' values (308 by default, don't set too big limit to avoid of OOM errors or attacks from untrusted input)
- bitSetValueLimit
-
an exclusive limit for accepted numeric values in bit sets (1024 by default, don't set too big limit to avoid of OOM errors or attacks from untrusted input)
- checkFieldDuplication
-
a flag that turns on checking of duplicated fields during parsing of classes (turned on by default)
- circeLikeObjectEncoding
-
a flag that turns on serialization and parsing of Scala objects as JSON objects with a key and empty object value:
{"EnumValue":{}}
- decodingOnly
-
a flag that turns generation of decoding implementation only (turned off by default)
- discriminatorFieldName
-
an optional name of discriminator field, where None can be used for alternative representation of ADTs without the discriminator field (Some("type") by default)
- encodingOnly
-
a flag that turns generation of encoding implementation only (turned off by default)
- fieldNameMapper
-
the partial function of mapping from string of case class field name to JSON key (an identity function by default)
- inlineOneValueClasses
-
a flag that turns on derivation of inlined codecs for non-values classes that have the primary constructor with just one argument (turned off by default)
- isStringified
-
a flag that turns on stringification of number or boolean values of collections, options and value classes (turned off by default)
- javaEnumValueNameMapper
-
the partial function of mapping from string of Java enum name to JSON key (an identity function by default)
- mapAsArray
-
a flag that turns on serialization and parsing of maps as a JSON array (or sequences of tuples) instead of a JSON object, that allow to use 'JsonValueCodec' for encoding and decoding of keys (turned off by default)
- mapMaxInsertNumber
-
a max number of inserts into maps (1024 by default to limit attacks from untrusted input that exploit worst complexity for inserts, see https://github.com/scala/bug/issues/11203 )
- requireCollectionFields
-
a flag that turn on checking of presence of collection fields and forces serialization when they are empty
- requireDefaultFields
-
a flag that turns on checking of presence of fields with default values and forces serialization of them
- requireDiscriminatorFirst
-
a flag that turns off limitation for a position of the discriminator field to be the first field of the JSON object (turned on by default to avoid CPU overuse when the discriminator appears in the end of JSON objects, especially nested)
- scalaTransientSupport
-
a flag that turns on support of
scala.transient
(turned off by default) - setMaxInsertNumber
-
a max number of inserts into sets excluding bit sets (1024 by default to limit attacks from untrusted input that exploit worst complexity for inserts, see https://github.com/scala/bug/issues/11203 )
- skipNestedOptionValues
-
a flag that turns on skipping of some values for nested more than 2-times options and allow using
Option[Option[_]]
field values to distinguishnull
and missing field cases - skipUnexpectedFields
-
a flag that turns on skipping of unexpected fields or in other case a parse exception will be thrown (turned on by default)
- transientDefault
-
a flag that turns on skipping serialization of fields that have same values as default values defined for them in the primary constructor (turned on by default)
- transientEmpty
-
a flag that turns on skipping serialization of fields that have empty values of arrays or collections (turned on by default)
- transientNone
-
a flag that turns on skipping serialization of fields that have empty values of options (turned on by default)
- useScalaEnumValueId
-
a flag that turns on using of ids for parsing and serialization of Scala enumeration values
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
- Self type
-
CodecMakerConfig.type
An extension of JsonValueCodec[A]
that could be used to derive codecs using the ... derives ...
syntax.
An extension of JsonValueCodec[A]
that could be used to derive codecs using the ... derives ...
syntax.
A compile-time configuration can be provided by an inline given CodecMakerConfig
value, which needs to be visible in the scope, and defined/imported before the ... derives ...
syntax usage.
BEWARE: Using of this class requires runtime scope for the jsoniter-scala-macros
dependency.
Also, to avoid overhead in runtime use it only for top-level and big commonly used data structures.
Attributes
- Companion
- object
- Supertypes
-
trait JsonValueCodec[A]trait Serializableclass Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
JsonCodecMaker.type
Attributes
- Supertypes
-
trait StaticAnnotationclass Annotationclass Objecttrait Matchableclass Any
Attributes
- Supertypes
-
trait StaticAnnotationclass Annotationclass Objecttrait Matchableclass Any
Attributes
- Supertypes
-
trait StaticAnnotationclass Annotationclass Objecttrait Matchableclass Any