File tree Expand file tree Collapse file tree 4 files changed +144
-114
lines changed
jsoniter-scala-macros/shared/src
scala-2/com/github/plokhotnyuk/jsoniter_scala/macros
scala-3/com/github/plokhotnyuk/jsoniter_scala/macros
test/scala/com/github/plokhotnyuk/jsoniter_scala/macros Expand file tree Collapse file tree 4 files changed +144
-114
lines changed Original file line number Diff line number Diff line change @@ -507,6 +507,16 @@ object JsonCodecMaker {
507
507
*/
508
508
def makeWithRequiredDefaultFields [A ]: JsonValueCodec [A ] = macro Impl .makeWithRequiredDefaultFields[A ]
509
509
510
+ /**
511
+ * A replacement for the `make` call with the
512
+ * `CodecMakerConfig.withSkipNestedOptionValues(true)`
513
+ * configuration parameter.
514
+ *
515
+ * @tparam A a type that should be encoded and decoded by the derived codec
516
+ * @return an instance of the derived codec
517
+ */
518
+ def makeWithSkipNestedOptionValues [A ]: JsonValueCodec [A ] = macro Impl .makeWithSkipNestedOptionValues[A ]
519
+
510
520
/**
511
521
* A replacement for the `make` call with the
512
522
* `CodecMakerConfig.withTransientEmpty(false).withTransientDefault(false).withTransientNone(false).withDiscriminatorFieldName(None)`
@@ -553,6 +563,9 @@ object JsonCodecMaker {
553
563
def makeWithRequiredDefaultFields [A : c.WeakTypeTag ](c : blackbox.Context ): c.Expr [JsonValueCodec [A ]] =
554
564
make(c)(CodecMakerConfig .withTransientDefault(false ).withRequireDefaultFields(true ))
555
565
566
+ def makeWithSkipNestedOptionValues [A : c.WeakTypeTag ](c : blackbox.Context ): c.Expr [JsonValueCodec [A ]] =
567
+ make(c)(CodecMakerConfig .withSkipNestedOptionValues(true ))
568
+
556
569
def makeCirceLike [A : c.WeakTypeTag ](c : blackbox.Context ): c.Expr [JsonValueCodec [A ]] =
557
570
make(c)(CodecMakerConfig .withTransientEmpty(false ).withTransientDefault(false ).withTransientNone(false )
558
571
.withDiscriminatorFieldName(None ).withCirceLikeObjectEncoding(true ))
Original file line number Diff line number Diff line change @@ -557,6 +557,16 @@ object JsonCodecMaker {
557
557
*/
558
558
inline def makeWithRequiredDefaultFields [A ]: JsonValueCodec [A ] = $ {Impl .makeWithRequiredDefaultFields}
559
559
560
+ /**
561
+ * A replacement for the `make` call with the
562
+ * `CodecMakerConfig.withSkipNestedOptionValues(true)`
563
+ * configuration parameter.
564
+ *
565
+ * @tparam A a type that should be encoded and decoded by the derived codec
566
+ * @return an instance of the derived codec
567
+ */
568
+ inline def makeWithSkipNestedOptionValues [A ]: JsonValueCodec [A ] = $ {Impl .makeWithSkipNestedOptionValues}
569
+
560
570
/**
561
571
* A replacement for the `make` call with the
562
572
* `CodecMakerConfig.withTransientEmpty(false).withTransientDefault(false).withTransientNone(false).withDiscriminatorFieldName(None)`
@@ -598,6 +608,9 @@ object JsonCodecMaker {
598
608
def makeWithRequiredDefaultFields [A : Type ](using Quotes ): Expr [JsonValueCodec [A ]] =
599
609
make(CodecMakerConfig .withTransientDefault(false ).withRequireDefaultFields(true ))
600
610
611
+ def makeWithSkipNestedOptionValues [A : Type ](using Quotes ): Expr [JsonValueCodec [A ]] =
612
+ make(CodecMakerConfig .withSkipNestedOptionValues(true ))
613
+
601
614
def makeWithRequiredCollectionFieldsAndNameAsDiscriminatorFieldName [A : Type ](using Quotes ): Expr [JsonValueCodec [A ]] =
602
615
make(CodecMakerConfig .withTransientEmpty(false ).withRequireCollectionFields(true )
603
616
.withDiscriminatorFieldName(Some (" name" )))
You can’t perform that action at this time.
0 commit comments