# Azure Functions Validation

> Validation and serialization layer for the Azure Functions Python v2 programming model.

Part of the **Azure Functions Python DX Toolkit**. Pydantic-powered request validation and response serialization for HTTP-triggered functions — validate body, query, path, and header parameters with a decorator, bringing a FastAPI-like developer experience to Azure Functions. Install from PyPI with `pip install azure-functions-validation`.

## Getting Started
- [Installation](https://yeongseon.dev/azure-functions-python/validation/installation/): Install the package.
- [Quickstart](https://yeongseon.dev/azure-functions-python/validation/getting-started/): Minimal end-to-end example.
- [Configuration](https://yeongseon.dev/azure-functions-python/validation/configuration/): Customize validation behavior.
- [Strict API Boundary Models](https://yeongseon.dev/azure-functions-python/validation/strict-models/): Choose strict JSON body models without breaking string-based query, path, and header inputs.
- Custom formatters receive original 4xx exceptions and sanitized 5xx errors by default.
- Successful responses default to status 200; set `status_code` for another success code.
- `legacy_loc` temporarily omits input-source prefixes from error locations.
- `request_model` is deprecated; use `body` instead.
- `aggregate_validation_errors=True` collects request-source validation failures
  into one 422; the default remains fail-fast.
- Opt-in body policies return 413 for `max_body_bytes` and 415 for non-JSON
  non-empty bodies under `require_json_content_type`; defaults preserve current behavior.
- Validated responses support `response_by_alias`, `response_exclude_none`, and
  `response_exclude_unset`; these require `response_model` and do not apply to
  direct `HttpResponse` returns.
- Custom adapters raise `MalformedRequestError` for malformed syntax (400) and
  `AdapterValidationError` for validation failures (422); other exceptions are
  logged and sanitized as 500.
- Adapter instances are shared across concurrent invocations and must be
  stateless or thread-safe. Validate implementations with
  `AdapterConformanceTests` from the public testing surface.

## User Guide
- [Usage](https://yeongseon.dev/azure-functions-python/validation/usage/): Decorator reference and models.
- [Architecture](https://yeongseon.dev/azure-functions-python/validation/architecture/): How the validation pipeline works.

## Examples
- [Basic Validation](https://yeongseon.dev/azure-functions-python/validation/examples/basic_validation/): Body validation.
- [Query/Path/Header](https://yeongseon.dev/azure-functions-python/validation/examples/query_validation/): Non-body parameters.
- [Async Validation](https://yeongseon.dev/azure-functions-python/validation/examples/async_validation/): Async handlers.
- [CRUD API](https://yeongseon.dev/azure-functions-python/validation/examples/crud_api/): Full example.

## Reference
- [API Reference](https://yeongseon.dev/azure-functions-python/validation/api/): Public API surface.
- [FAQ](https://yeongseon.dev/azure-functions-python/validation/faq/): Frequently asked questions.
- [Troubleshooting](https://yeongseon.dev/azure-functions-python/validation/troubleshooting/): Common issues and fixes.
