RecordOps

final implicit class RecordOps[A](recordA: Record[A]) extends JsonSchemaDocumentationOps[A]

Implicit methods for values of type Record

class Object
trait Matchable
class Any

Type members

Types

type Self = Record[A]

Value members

Concrete methods

def named(name: String): Record[A]

Give a name to the schema

Give a name to the schema

  • Encoder and decoder interpreters ignore the name,
  • Documentation interpreters use that name to refer to this schema.
Note:

Names are used by documentation interpreters to construct references and the JSON schema specification requires these to be valid URI's. Consider using withTitle if you just want to override the heading displayed in documentation.

def tagged(tag: String): Tagged[A]

Tag a schema for type A with the given tag name

Tag a schema for type A with the given tag name

This operation is usually used in conjunction with the orElse operation on the resulting Tagged value, to define a schema that accepts several alternatives, discriminated by a type tag.

  • Encoder interpreters include a discriminator field to the JSON object they produce. The name of the discriminator field is “type”, by default, but can be customized by calling the withDiscriminator operation or by overriding the defaultDiscriminatorName operation of the trait JsonSchemas,
  • Decoder interpreters validate that the discriminator field is present before validating the remaining fields of the object,
  • Documentation interpreters produce a oneOf schema listing all the alternative schemas.
Value parameters:
tag

Tag name (e.g., "Rectangle", "Circle")

def withDescription(description: String): Record[A]
def withExample(example: A): Record[A]
def withTitle(title: String): Record[A]
def zip[B](recordB: Record[B])(implicit t: Tupler[A, B]): Record[Out]

Merge the fields of recordA with the fields of recordB

Merge the fields of recordA with the fields of recordB

  • Encoder interpreters produce a JSON object with the fields of both recordA and recordB,
  • Decoder interpreters validate the fields of recordA and recordB,
  • Documentation interpreters produce the schema of a JSON object containing the properties of both recordA and recordB.