Base class for generating database schema JSON output files. Creates comprehensive JSON documentation of database schemas including:

  • Full entity definitions with all field details
  • Simplified versions for lighter consumption
  • Schema-specific and bundled outputs
  • Minified versions for production use

You can sub-class this class to create custom schema generation logic.

Constructors

Methods

  • Properly escapes a string for JSON output, handling all control characters

    Parameters

    • str: undefined | null | string

      The string to escape

    Returns string

    The escaped string safe for JSON

  • Generates JSON representation for a specific database schema

    Parameters

    • entities: EntityInfo[]

      Array of entities in this schema

    • excludeEntities: string[]

      Array of entity names to exclude from output

    • schemaName: string

      Name of the schema being processed

    • simpleVersion: boolean

      Whether to generate simplified output (field names only)

    Returns string

    JSON string representing the schema

  • Main entry point for generating database schema JSON files. Creates multiple output formats for different consumption needs:

    • Individual schema files (full and simple)
    • Combined all-schemas files
    • Configured bundle files
    • Minified versions of all outputs

    Parameters

    • entities: EntityInfo[]

      Array of entities to process

    • outputDir: string

      Directory to write the JSON files to

    Returns boolean

    True if generation was successful, false otherwise

  • Generates JSON representation for a single entity

    Parameters

    • entity: EntityInfo

      The entity to generate JSON for

    • simpleVersion: boolean

      Whether to generate simplified output

    Returns string

    JSON string representing the entity

  • Generates JSON representation for a single entity field

    Parameters

    • field: EntityFieldInfo

      The field to generate JSON for

    • simpleVersion: boolean

      Whether to generate simplified output (currently unused for fields)

    Returns string

    JSON string representing the field with type, relationships, and constraints