Skip to content

Commit

Permalink
Add feature flag for the crate reorganization (smithy-lang#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Feb 16, 2023
1 parent ba3b937 commit 52b07c2
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -86,6 +86,8 @@ data class ClientCodegenConfig(
val addMessageToErrors: Boolean = defaultAddMessageToErrors,
// TODO(EventStream): [CLEANUP] Remove this property when turning on Event Stream for all services
val eventStreamAllowList: Set<String> = defaultEventStreamAllowList,
// TODO(CrateReorganization): Remove this once we commit to the breaking change
val enableNewCrateOrganizationScheme: Boolean = defaultEnableNewCrateOrganizationScheme,
) : CoreCodegenConfig(
formatTimeoutSeconds, debugMode,
) {
Expand All @@ -94,6 +96,7 @@ data class ClientCodegenConfig(
private const val defaultIncludeFluentClient = true
private const val defaultAddMessageToErrors = true
private val defaultEventStreamAllowList: Set<String> = emptySet()
private const val defaultEnableNewCrateOrganizationScheme = false

fun fromCodegenConfigAndNode(coreCodegenConfig: CoreCodegenConfig, node: Optional<ObjectNode>) =
if (node.isPresent) {
Expand All @@ -106,12 +109,14 @@ data class ClientCodegenConfig(
renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", defaultRenameExceptions),
includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", defaultIncludeFluentClient),
addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", defaultAddMessageToErrors),
enableNewCrateOrganizationScheme = node.get().getBooleanMemberOrDefault("enableNewCrateOrganizationScheme", false),
)
} else {
ClientCodegenConfig(
formatTimeoutSeconds = coreCodegenConfig.formatTimeoutSeconds,
debugMode = coreCodegenConfig.debugMode,
eventStreamAllowList = defaultEventStreamAllowList,
enableNewCrateOrganizationScheme = defaultEnableNewCrateOrganizationScheme,
)
}
}
Expand Down

0 comments on commit 52b07c2

Please sign in to comment.