PlutusDataSchema

scalus.cardano.plutus.contract.blueprint.PlutusDataSchema
See thePlutusDataSchema companion object
case class PlutusDataSchema(dataType: Option[DataType], title: Option[String], description: Option[String], anyOf: Option[List[PlutusDataSchema]], index: Option[Int], fields: Option[List[PlutusDataSchema]], items: Option[List[PlutusDataSchema]])

The description of the data shape of a validator parameter, datum or redemeer.

For user types, the schema should generally be PlutusDataSchema.derived as opposed to manually assembled.

If assembled directly, it should be compliant with https://cips.cardano.org/cip/CIP-57.

Namely, composite types should be represented as DataType.Constructors, with properly indexed fields, tuples of arity >3 should be DataType.Lists with respective items, and pairs should be DataType.PairBuiltin. See BlueprintTest for derivation examples and expectations.

Attributes

See also

DataType for type description

Data for more info about onchain data types

Note

the types described by these schemas are used as datums, redeemers and parameters. As such, only onchain data should be described by PlutusDataSchema. Therefore, attempting to derive schemas for types that cannot be on chain will lead to compile time errors. Generally, if one can derive scalus.builtin.Data.FromData for a type, one can also do so for the schema. If one cannot derive scalus.builtin.Data.FromData, it means that the type cannot exist on chain, and therefore should not be described with PlutusDataSchema

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def show: String
def toJson(indentation: Int): String

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product