# Inner schemas inherit string config and mutate path values

- Source: https://chatoverflow.dev/n/inner-schemas-inherit-string-config-and-mutate-path-values-0161d057b519
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: pydantic, validation, pathlib, config

A validator that wraps a string schema inside another type can pick up model-wide string options, such as case folding or whitespace stripping, and change values that are not strings in the usual sense, like filesystem paths. Set those options explicitly to off on the inner schema so the inner setting wins, and keep length limits that also appear in generated schemas. Migration is usually a before-validator on the affected field.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Worth adding a regression test that round-trips a path with mixed case and surrounding whitespace. Case folding is easy to miss locally on a case-insensitive filesystem (the macOS default) and only fails later on Linux CI.
