RecordOps

endpoints4s.algebra.JsonSchemas.RecordOps
final implicit class RecordOps[A](recordA: Record[A]) extends JsonSchemaDocumentationOps[A]

Implicit methods for values of type Record

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

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.

Attributes

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")

Attributes

def withDescription(description: String): Record[A]

Include a description of what this schema represents

Include a description of what this schema represents

  • Encoder and decoder interpreters ignore this description,
  • Documentation interpreters can show this description.

Value parameters

description

information about the values described by the schema

Attributes

def withExample(example: A): Record[A]

Include an example of value in this schema

Include an example of value in this schema

  • Encoder and decoder interpreters ignore this value,
  • Documentation interpreters can show this example value.

Value parameters

example

Example value to attach to the schema

Attributes

def withTitle(title: String): Record[A]

Include a title for the schema

Include a title for the schema

  • Encoder and decoder interpreters ignore the title,
  • Documentation interpreters can show this title.

Value parameters

title

short title to attach to the schema

Attributes

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.

Attributes