# Defining Schema

## Content

A schema defines how a table interprets and manages its data.
When a table is created in DataManager, the schema describes:

* How raw data is parsed
* How fields are structured and typed
* How computed values are defined
* Whether the table has reusable window specifications
* Whether the table is hierarchical

The schema belongs to the table and determines its structural behavior.

## What Happens Without a Schema

If no schema is provided:

* Data is loaded using default parsing rules
* Fields are inferred directly from raw data
* No structural constraints or computed columns are applied
* No hierarchy or reusable window definitions are available

Providing a schema enables explicit control over structure and behavior.

## Schema Structure

The schema is defined inside the table options:

```javascript
dataManager.addTable("orders", {
    data: [...],
    schema: {
        // schema configuration
    }
});
```

The schema may include the following major sections:

```typescript
interface ISchemaOption {
    type?: string;               // parsing type
    dataPath?: string;           // nested data path
    columns?: {...};             // column definitions
    window?: {...};              // reusable window definitions
    hierarchy?: {...};           // hierarchical structure
}
```

Each section controls a specific aspect of table structure.

## Data Parsing

Parsing configuration determines how raw data is interpreted.
It controls:

* Data source type (for example, JSON or CSV)
* Nested data extraction
* Field normalization rules

See **[Data Parsing](/spreadjs/docs/features/data-manager/schema/data-parsing)** for details.

## Defining Columns

Columns define how individual fields behave inside the table.
They control:

* Field mapping and identity
* Data types
* Validation rules
* Computed values
* Presentation metadata

See **[Defining Columns](/spreadjs/docs/features/data-manager/schema/defining-columns)** for detailed configuration.

## Window Definitions

Window definitions provide reusable window specifications for `WINDOW()` formulas.
They:

* Define partitioning, ordering, and frame rules
* Improve reuse and consistency
* Affect formula evaluation only

See **[Window Definition](/spreadjs/docs/features/data-manager/schema/window-definition)** for details.

## Hierarchical Configuration

Hierarchy configuration organizes records into parent–child structures within a single table.
It defines:

* How parent relationships are derived
* How nested structures are interpreted
* Optional summary field behavior

See **[Hierarchical Data](/spreadjs/docs/features/data-manager/schema/hierarchical-data)** for details.

## Responsibility Boundary

The schema defines structural behavior inside DataManager.
It:

* Does not control remote communication
* Does not render UI
* Does not define cross-table relationships
* Does not execute CRUD operations

Those responsibilities belong to other parts of the system.
The schema focuses solely on how a table understands and organizes its own data.