๐Ÿ› Fix non-deterministic openapi spec in case of duplicated model names by igoyak ยท Pull Request #14797 ยท fastapi/fastapi

@igoyak igoyak marked this pull request as ready for review

February 1, 2026 14:56

YuriiMotov

@igoyak

v0.128.0 introduced non-deterministic openapi spec schema naming in
the case of multiple pydantic models with the same name.

Commit [e300630](fastapi@e300630#diff-1086603fdd56511aafd1d279396b142b803e48164327148e6de26cef4cdaed81L504)
removed the check for conflicting names.

The component names two classes named `User` would randomly be either

```
User
tests__test_duplicate_model_names_openapi__b__model__User
```

```
tests__test_duplicate_model_names_openapi__a__model__User
User
```

With this change, we reintroduce the conflict check to always use
a hash of the fully qualified names in case of conflict.

@pre-commit-ci-lite

@YuriiMotov YuriiMotov changed the title Fix non-deterministic openapi spec ๐Ÿ› Fix non-deterministic openapi spec in case of duplicated model names

Feb 3, 2026