Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseSchema<T, S>

Type parameters

  • T

  • S

Hierarchy

Index

Constructors

constructor

  • new BaseSchema(plain?: Partial<S>, extract?: Extract<keyof S, keyof Common>[]): BaseSchema
  • Parameters

    • Optional plain: Partial<S>
    • Default value extract: Extract<keyof S, keyof Common>[] = []

    Returns BaseSchema

Properties

context

context: Common = <Common>{}

extract

extract: ("name" | "namespace" | "aliases" | "doc" | "default" | "order")[]

plain

plain: S

type

type: T

Methods

aliases

  • aliases(...aliases: string[]): this

copyWith

  • copyWith(modifyObject: any): this
  • Make copy of current schema with modified values

    Parameters

    • modifyObject: any

    Returns this

default

  • default(def: T): this

doc

  • doc(doc: string): this

logicalType

  • logicalType(logicalType: Required<BaseAvroSchema>["logicalType"], raw?: undefined | { precision: number; scale?: undefined | number }): this
  • logicalType(logicalType: string, raw?: undefined | object): this
  • logicalType<N>(logicalType: Required<BaseAvroSchema>["logicalType"], raw?: undefined | { precision: number; scale?: undefined | number }): BaseSchema<N, S>
  • logicalType<N>(logicalType: string, raw?: undefined | object): BaseSchema<N, S>
  • Set logical type for the schema

    reference

    http://avro.apache.org/docs/1.9.2/spec.html#Logical+Types

    Parameters

    • logicalType: Required<BaseAvroSchema>["logicalType"]
    • Optional raw: undefined | { precision: number; scale?: undefined | number }

    Returns this

  • Parameters

    • logicalType: string
    • Optional raw: undefined | object

    Returns this

  • Type parameters

    • N

    Parameters

    • logicalType: Required<BaseAvroSchema>["logicalType"]
    • Optional raw: undefined | { precision: number; scale?: undefined | number }

    Returns BaseSchema<N, S>

  • Type parameters

    • N

    Parameters

    • logicalType: string
    • Optional raw: undefined | object

    Returns BaseSchema<N, S>

name

  • name(name: string): this

namespace

  • namespace(namespace: string): this

order

  • order(order: "ascending" | "descending" | "ignore"): this

raw

  • raw(plain: {}): this
  • Add custom fields to the schema

    Parameters

    • plain: {}

    Returns this

valueOf

  • valueOf(): S
  • It returns the plain schema

    Returns S

Generated using TypeDoc