Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SchemaImpl

Implementation of ConcreteSchema which extends the Record V2 Schema interface

Hierarchy

  • SchemaImpl

Implements

Index

Constructors

constructor

  • Create a new Schema

    Parameters

    • recordV2Constructor: {}

      a constructor function for creating RecordV2 implementations

    • records: RecordImpl[]

      an array of record schema

    Returns SchemaImpl

Properties

Private Readonly recordV2Constructor

recordV2Constructor: {}

A constructor function for creating RecordV2 implementations

Type declaration

Private Readonly recordsArray

recordsArray: RecordImpl[]

The array of record schema

Private Readonly recordsMap

recordsMap: {}

The record schema indexed by name

Type declaration

Methods

asJSON

  • asJSON(): string
  • Returns the schema in a JSON format

    Returns string

    schema in JSON format

createModel

  • Create a RecordData model representation of the schema

    Returns RecordData[]

    an array of arrays containing model field data

createMutableModel

  • Create a mutable model based upon the schema.

    The model will be created with all mandatory record occurrences and all mandatory field occurrences initialized to default values.

    Such a model may be mutated and used to generate updated RecordV2 occurrences for updating purposes.

    Returns MutableRecordModelImpl

    a new initialized model

firstRecord

  • Get the first record in the records array

    Returns RecordImpl

    the record at position 0 in the records array

getRecord

  • Get a record by the record name

    throws

    a SchemaViolationError if the record is not found

    Parameters

    • name: string

      the record name

    Returns RecordImpl

    the record that was found

getRecords

  • Returns an immutable, ordered list of record definitions.

    There will be at least one.

    Returns RecordImpl[]

    a list of the record definitions in the schema

lastRecord

  • Get the last record in the records array

    Returns RecordImpl

    the record at the last position in the records array

records

  • Get an array of all records in the schema

    Returns RecordImpl[]

    the records in the schema

toString

  • toString(): string
  • Convert the schema to a string

    Returns string

    a string representation of the schema

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.