Skip to content

Add the ability to set feature flags #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

czechboy0
Copy link
Contributor

Motivation

For a few upcoming features, we'd like to stage them into the current stable version and try them out, to get feedback and iterate before we tag a new breaking version.

Some examples of breaking features that could benefit from this:

  • multiple request and response content types
  • improved OpenAPI -> Swift name mapping
  • new currency types based on swift-http-types
  • async request and response bodies

It would be great to stage these in gradually, and consolidate a few of them into shared breaking versions, to avoid too much churn.

Modifications

This PR adds the concept of feature flags on the generator. They can be set either on the CLI, or in the config file.

The idea is that the translator logic will later inspect the list of feature flags, and change behavior accordingly (not present in this PR).

Note that I had to already add the multipleContentTypes feature flag, as keeping the enum empty broke the build. But that's okay, feature flags should be introduced early in the development process of a feature anyway.

Result

Now adopters can optionally enable pre-release features, and we can get feedback and run experiments before tagging a new breaking version.

Test Plan

Manually tested, with a debugger, that the feature flags propagate through the CLI machinery all the way to the generator pipeline.

@czechboy0 czechboy0 requested a review from simonjbeaumont July 25, 2023 11:50
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Jul 25, 2023
@czechboy0 czechboy0 merged commit 22a7d7a into apple:main Jul 25, 2023
@czechboy0 czechboy0 deleted the hd-feature-flags branch July 25, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants