Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SchemaPayloadGenerator

Generates possible payloads according to a JSON schema

Hierarchy

  • SchemaPayloadGenerator

Index

Constructors

constructor

Properties

Protected fieldProcessors

fieldProcessors: object

Processing classes for the schema fields

Type declaration

options

schema

schema: JSONSchema6

The master schema to work from

Methods

calculateFieldPayloadCount

calculatePayloadCount

  • calculatePayloadCount(definitionKey?: string): Promise<number>
  • Generates the payload count without actually generating them (if possible)

    Parameters

    • Optional definitionKey: string

      In case the schema contains several definitions, which on to generate values for

    Returns Promise<number>

Private extractMasterField

  • extractMasterField(definitionKey?: string): object
  • Extracts the master schema field to process

    Parameters

    • Optional definitionKey: string

      In case the schema contains several definitions, which on to generate values for

    Returns object

    • keyReportName: string
    • masterField: JSONSchema6

generateFieldPayloads

generatePayloads

Private initFieldProcessors

  • initFieldProcessors(): void

loadSchema

  • loadSchema(schema: JSONSchema6 | string, parserOptions?: $RefParser.Options): Promise<void>
  • Load a master schema before generating values The schema will be parsed by json-schema-ref-parser

    Parameters

    • schema: JSONSchema6 | string

      Either a schema object (may contain $ref fields) or a relative path to one

    • Optional parserOptions: $RefParser.Options

      json-schema-ref-parser options (will be passed to the parser)

    Returns Promise<void>

Private parseOptions

report

  • report(message: string, endWithNewLine?: boolean): void
  • Reports a message to stdout

    Parameters

    • message: string

      The message to report

    • Default value endWithNewLine: boolean = true

      End the message with a new line (similar to console.log)

    Returns void

Private toCamelCase

  • toCamelCase(name: string): string

Generated using TypeDoc