Repository navigation
feat: rename inconsistent config fields, keeping the old names as deprecated aliases - #351
Merged
Merged
Conversation
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #318: the 1.x half. The 2.0 half, which deletes the old field names, stays open on the issue.
Nine config fields get consistent names. The old names keep working until 2.0, with a
DeprecationWarning.prometheus_instrumentator_paramsprometheus_instrumentator_additional_paramsprometheus_instrument_paramsprometheus_instrument_additional_paramsprometheus_expose_paramsprometheus_expose_additional_paramsswagger_extra_paramsswagger_additional_paramsfastapi_logging_middleware_enabledlogging_access_log_enabledlitestar_logging_middleware_enabledlogging_access_log_enabledfastmcp_logging_middleware_enabledlogging_access_log_enabledEvery forwarded-kwargs escape hatch now ends in
_additional_params, as four of them already did. The access-log flag has one name on the three HTTP configs and stays offLoggingConfig, because FastStream and Free mix that in and have no access log.litestar_logging_middleware_configkeeps its prefix because it carries a Litestar type, and its warning now names the new flag.How the aliases work:
UNSET, withrepr=Falseandcompare=False. A class-level_renamed_fieldsmap links it to its replacement.BaseConfig.__post_init__runs first in every config's cascade. If the caller set an old name, it copies the value into the new field, warns throughwarn_at_caller(so the warning points at the user's line), and resets the old field toUNSET. The reset keepsdataclasses.replace()working on a config built from an old name.ConfigurationError. An old name plus the new one at its default value is taken as the old one.from_dictandfrom_objectreaddataclasses.fields, so they accept the old keys too. A settings object that carries both names raises rather than silently picking one.BaseConfigand not in a__post_init__per config. FastMCP has no__post_init__of its own, and the FastMCP tests that reload the module would breaksuper(FastMcpConfig, self)on a config built from the pre-reload class. The forwarding callsdataclasses.fields()only when an old name is actually set, so building a config with the new names costs nothing extra.Tests, written first: for each of the nine renames, the old name sets the new field and warns at the caller, old plus new raises, and
from_dictaccepts the old key. There are also tests forfrom_objectwith both names and forreplace()after an old name. The existing tests, benchmark suites and docs now use the new names.swagger_additional_paramswas never documented, so the Swagger section ofconfiguration.mdgains a line for it.Verified: 451 tests pass at 100% coverage,
just lintis clean, and the suite emits no lite-bootstrapDeprecationWarning.