Repository navigation
refactor(config): split generator-owned contract from settings - #913
Merged
Merged
Conversation
Rename src/config.rs to src/settings.rs so hand-maintained configuration loading, precedence, and storage paths live in a module the generator does not overwrite. Callers of anything beyond Config and OutputFormat now import from crate::settings. This commit does not build on its own: the generator-owned crate::config contract is added in the next commit. It is split out so git tracks the rename and history follows settings.rs.
openapi-transformer copies its config asset over src/config.rs on every generation run, reverting hand-written changes. Make src/config.rs a narrow generator-owned contract that re-exports only Config and OutputFormat from crate::settings, mirroring the formatter/output split. The re-export is explicit rather than a glob so the rest of settings stays out of the generator-owned path.
MintsInc
marked this pull request as ready for review
October 14, 2026 13:07
Contributor
There was a problem hiding this comment.
More details
The existing configuration implementation is preserved, helper callers use settings, and both CLI and browser entry points declare the new module. The completed static review found no reportable regression in the Config and OutputFormat contract.
🤖 Bits Code Review · Commit f8daf4d
nogates
approved these changes
Oct 14, 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.
Context
openapi-transformer's pup generator copies its config asset over
src/config.rson every run. Any hand edit toconfig.rsin pup gets reverted by the next generated PR unless someone also mirrors it into the asset. That has happened twice: the regional OAuth fix (422e481) had to be re-synced into the asset after a generated PR reverted it. #908 currently deletesauth_config_dir()and the XDG-awareconfig_file_candidates()from #891 (3f5f913). Merging #908 would quietly move macOS auth storage back to the wrong directory.This is the same fix as the formatter split (
b112d16,4e45407): a small generator-owned contract, with the real logic in a hand-owned module.Changes
src/config.rsbecomes a generator-owned shim that re-exports onlyConfigandOutputFormat. Generated code, and theformatter.rs/client.rsassets, use nothing else fromcrate::config(checked against the generator's assets and templates).pub use crate::settings::*. A glob would put everything back behind the generator-owned path and make the boundary meaningless.config.rsmoves tosrc/settings.rsunchanged apart from dropping theDO NOT EDITheader. Callers of anything beyondConfig/OutputFormatnow import fromcrate::settings. The ~140 existingcrate::config::{Config, OutputFormat}imports are left alone because they go through the contract.config.rs→settings.rsrename andgit log --followkeeps working. The first commit doesn't build on its own; the second adds the shim.Tests
settings.rs, including the fourauth_config_dirtests and the two macOSconfig_file_candidatestests from macOS: file token storage writes to ~/Library/Application Support/pup, not the documented ~/.config/pup #891.cargo fmt --checkpasses locally. Clippy, tests and the WASM builds have not been run locally yet; CI covers them.Appendix
Code generated by openapi-transformerheader, unless a bypass label is set.🤖 Generated with Claude Code