Unverified Commit 52b07c2b authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Add feature flag for the crate reorganization (#2388)

parent ba3b9375
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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,
) {
@@ -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) {
@@ -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,
                )
            }
    }