> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: SchemaDefinition<Schema, StrictTableTypes>

> The definition of a Bijection project schema.

[server](/api/modules/server).SchemaDefinition

The definition of a Bijection project schema.

This should be produced by using [defineSchema](/api/modules/server#defineschema).

## Type parameters

| Name | Type |
| :- | :- |
| `Schema` | extends [`GenericSchema`](/api/modules/server#genericschema) |
| `StrictTableTypes` | extends `boolean` |

## Properties

### tables

• **tables**: `Schema`

***

### strictTableNameTypes

• **strictTableNameTypes**: `StrictTableTypes`

***

### schemaValidation

• `Readonly` **schemaValidation**: `boolean`

## Methods

### doc

▸ **doc**\<`TableName`>(`tableName`): [`DocValidator`](/api/modules/server#docvalidator)\<`TableName`, `Schema`\[`TableName`]\[`"validator"`]>

The validator for whole documents of a table in this schema: the table's
own validator with the `_id` and `_creationTime` system fields added.

**`Example`**

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export const get = query({
  args: { id: schema.id("messages") },
  returns: v.union(schema.doc("messages"), v.null()),
  handler: (ctx, args) => ctx.db.get(args.id),
});
```

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `tableName` | `TableName` | The name of a table in this schema. |

#### Returns

[`DocValidator`](/api/modules/server#docvalidator)\<`TableName`, `Schema`\[`TableName`]\[`"validator"`]>

A validator matching documents of that table.

***

### id

▸ **id**\<`TableName`>(`tableName`): [`VId`](/api/classes/values.VId)\<[`GenericId`](/api/modules/values#genericid)\<`IdTableInSchema`\<`Schema`, `TableName`>>, `"required"`>

The validator for IDs of a table in this schema.

Same as `v.id(tableName)`, but only accepts tables in this schema.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `tableName` | `TableName` | The name of a table in this schema. |

#### Returns

[`VId`](/api/classes/values.VId)\<[`GenericId`](/api/modules/values#genericid)\<`IdTableInSchema`\<`Schema`, `TableName`>>, `"required"`>

A validator matching IDs of that table.
