From 322610c67e40b5fe1fa1afd7128ac605c77404e2 Mon Sep 17 00:00:00 2001 From: LiLatee Date: Mon, 19 Feb 2024 16:09:44 +0100 Subject: [PATCH] fix: allocator for tristate_optional usage --- .../ferry_generator/lib/graphql_builder.dart | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/ferry_generator/lib/graphql_builder.dart b/packages/ferry_generator/lib/graphql_builder.dart index 08b582f4..2387fcf7 100644 --- a/packages/ferry_generator/lib/graphql_builder.dart +++ b/packages/ferry_generator/lib/graphql_builder.dart @@ -85,7 +85,7 @@ class GraphqlBuilder implements Builder { outputAssetId(_schemaId!, schemaExtension, config.outputDir); final schemaUrl = schemaOutputAsset.uri.toString(); - final schemaAllocator = GqlAllocator( + final allocator = GqlAllocator( buildStep.inputId.uri.toString(), config.sourceExtension, outputAssetId(buildStep.inputId, schemaExtension, config.outputDir) @@ -95,8 +95,6 @@ class GraphqlBuilder implements Builder { config.outputDir, ); - final varAllocator = schemaAllocator; - final dataToVarsMode = config.dataToJsonMode; final libs = { @@ -114,7 +112,7 @@ class GraphqlBuilder implements Builder { addTypenames(schema), p.basename(generatedFilePath(buildStep.inputId, varExtension)), config.typeOverrides, - varAllocator, + allocator, triStateValueConfig, config.shouldGenerateVarsCreateFactories), reqExtension: buildReqLibrary( @@ -128,25 +126,20 @@ class GraphqlBuilder implements Builder { config.typeOverrides, config.enumFallbackConfig, generatePossibleTypesMap: config.shouldGeneratePossibleTypes, - allocator: schemaAllocator, + allocator: allocator, triStateValueConfig: triStateValueConfig), }; for (var entry in libs.entries) { final generatedAsset = outputAssetId(buildStep.inputId, entry.key, config.outputDir); - final schemaOutputAsset = - outputAssetId(_schemaId, schemaExtension, config.outputDir); - - final allocator = GqlAllocator( - buildStep.inputId.uri.toString(), - config.sourceExtension, - generatedAsset.uri.toString(), - schemaOutputAsset.uri.toString(), - config.outputDir, - ); - await writeDocument(generatedAsset, entry.value, allocator, buildStep); + await writeDocument( + generatedAsset, + entry.value, + allocator, + buildStep, + ); } } }