Skip to content

Commit ca9e756

Browse files
Expanded on API stability to include feature flag details
1 parent 663dbcd commit ca9e756

File tree

1 file changed

+10
-2
lines changed
  • Sources/swift-openapi-generator/Documentation.docc/Proposals

1 file changed

+10
-2
lines changed

Sources/swift-openapi-generator/Documentation.docc/Proposals/SOAR-0012.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,17 @@ The initializer expression will never need to provide the allowed values paramet
298298

299299
This proposal creates new generated types and modifies the existing generated static functions for creating/accessing server definitions.
300300

301-
The change could be backwards compatible to any adopter that relies on default values provided by the static server functions.
301+
#### New Feature Flag
302302

303-
Adopters that do not rely on the default values will have compile errors, though migration should be a straight-forward change as adopters were previously unable to provide _any_ value due to runtime validation; the generated enum cases should have a similar spelling to the previous string counterpart.
303+
A feature flag, `serverVariablesAsEnums`, has been introduced to allow opt-in to the changes of this proposal.
304+
305+
When the feature flag is disabled the `RawStringTranslatedServerVariable` generator will be used for **all** variables, resulting in an identical output to the previous generator. However, when the feature flag is enabled the `GeneratedEnumTranslatedServerVariable` generator will be used for any variable that declares an enum field, and the `RawStringTranslatedServerVariable` generator will be used otherwise.
306+
307+
#### Compatibility
308+
309+
Given the previous generation, any adopter that relied on default values provided by the static server functions, e.g. `let url = try Servers.server1()`, will not experience any breaking changes by adopting the implementation from this proposal. The new generators will still provide valid default parameters, even for the generated Swift enums. Adopters that do not rely on the default values, however, will experience compile errors by adopting the changes in this proposal; though migration should be a straight-forward change as adopters were previously unable to provide _any_ value due to runtime validation, so the generated enum cases should have a similar spelling/shape to the previous string counterpart.
310+
311+
#### Other components
304312

305313
No API changes are required to other components, though once this proposal is adopted the runtime component _could_ remove the runtime validation of allowed values since the generated code guarantees the `rawValue` is in the document.
306314

0 commit comments

Comments
 (0)