[NFC] Inject asSwiftSafeName as a dependency #148
Merged
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.
Motivation
Arguably, we should have done this before, but here we go. In order to allow dynamically customizing the logic for converting OpenAPI to Swift identifiers (in support of staging SOAR-0001 gradually), we need to dependency-inject the
(String) -> String
function to all the places that need to do this conversion.Modifications
This PR doesn't change any behavior (NFC - no functional change), it just refactors the code to have a single funnel point through which all the conversion goes, which has access to the
Config
and can inspect feature flags.Right now, the default behavior is still the same, but this PR creates room for adding the alternative logic from SOAR-0001.
Result
NFC, prepares room for a subsequent PR.
Now it's possible to conditionalize the Swift name computing logic based on feature flags.
Test Plan
All tests are passing, adapted as needed, created conveniences in tests for getting a default
Config
, but also made it possible to test the logic by explicitly passing the feature flag.