Packages

o

com.digitalasset.canton.http.json.v2

CirceRelaxedCodec

object CirceRelaxedCodec

This codec automatically fills missing json attributes as long as they are Seq, Option or Map.

This emulates to some extent gRPC / proto behaviour, where all fields are optional.

We should use:

  • deriveRelaxedCodec:
    • for gRPC scalaPb generated case classes
  • deriveConfiguredCodec:
    • for JS mirrors of gRPC classes
    • for proto base lib classes (not generated), (they have default value)
    • for gRPC scalaPb generated roots of ADT

For scalar types that should have default values, you can use the extension deriveRelaxedCodedWithDefaults which takes a map of default values.

DO NOT USE deriveRelaxedCodec FOR Protobuf ENUM.

You will likely get: 'JSON decoding to CNil should never happen'. In this case, create separate Encoder / Decoder using stringDecoderForEnum / stringEncoderForEnum.

Do not forget to also create a Schema for the openapi.yml encoding. Otherwise, your enum will be translated into objects and you will likely end up with inconsistencies between Tapir and the openapi.yml.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CirceRelaxedCodec
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def deriveRelaxedCodec[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T], c: Lazy[ConfiguredAsObjectCodec[T]]): AsObject[T]
    Annotations
    @SuppressWarnings()
  7. def deriveRelaxedCodecWithDefaults[T](defaults: Map[String, Json])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T], c: Lazy[ConfiguredAsObjectCodec[T]]): AsObject[T]

    derived codec that supports using default scalar values

  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped