---
title: Adding configuration options
description: Extend Pydantic models in config.py, validation, and JSON schema for new knobs.
---

User-visible JSON is defined by **`src/scheduler/config.py`** using Pydantic v2 **`StrictBaseModel`** (`extra="forbid"`, `strict=True`).

## Steps

1. **Model** — Add fields to the appropriate nested model (`SchedulerConfig`, `FacultyConfig`, `CourseConfig`, `TimeSlotConfig`, etc.) or top-level **`CombinedConfig`**.
2. **Types** — Reuse **`TimeString`**, **`TimeRangeString`**, **`Preference`**, **`Day`**, or add new **`Annotated[..., Field(...)]`** aliases for reuse and JSON Schema quality.
3. **Validators** — Use **`field_validator`** / **`model_validator`** for cross-field rules; keep error messages explicit.
4. **Consumption** — Read the new fields from **`Scheduler`** (or **`TimeSlotGenerator`**, server, CLI) where behavior should change.
5. **Docs** — Update the **Configuration** pages in this site and add/fix tests.

## Strictness

Because **`extra="forbid"`**, clients get errors on unknown keys — document new keys in the changelog and configuration pages when you ship them.

## JSON Schema

CI regenerates **`fern/docs/assets/combined-config.schema.json`**. Run locally:

```bash
uv run python scripts/export_config_schema.py
```

## REST / OpenAPI

**`scheduler.server`** uses **`CombinedConfig`** as the **`POST /submit`** body type, so FastAPI’s OpenAPI (and this site’s **REST API** section) update when models change. Regenerate **`fern/openapi.json`** with:

```bash
uv run python scripts/export_openapi.py
```
