This trait describes various types that a Daml package can contain. SchemaProcessor will use an implementation of this trait to feed types into the visitor. The visitor implementation should define SchemaVisitor.Type, which can be a Codec, or a Code-generator along with instructions how to process daml types. There are several use cases:
==Codecs==
To achieve the best performance, a codec should create a tree-like structure copying the structure of Daml types with each node processing corresponding daml type and delegating processing to the next node if it's a type container.
A codec should convert to and from DynamicValue instances. This allows to compose codecs from various protocols by combining them in com.digitalasset.transcode.Converter. For example, one code combine JsonCodec and ProtobufCodec to get direct conversions from json to Ledger API proto values and vice versa. Or one can compose JsonCodec and ScalaCodec, etc.
Note, that Dynamic Values omit some type information (like field names or variant names) to reduce memory allocation and serialization. This information is known to the codec at the type of construction and codecs are encouraged to cache it.
==Code generators==
Code generators can produce code snippets at each handler and combine them into a file or a set of files that can be used as generated source in the target language.
It is advisable to also generate a codec along with DTOs (Data Transfer Object) to allow for direct interoperability with other existing protocols (Json or Protobuf).
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes