Skip to content
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

Add feature flag for the crate reorganization #2388

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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