Skip to content

Commit bf781c6

Browse files
committed
Fix JSON formatting issue in config post-processing
- Replace PowerShell JSON round-trip with text-based regex replacement - Preserves original CLI-generated formatting - Fixes GetBooks and GetPublisher operations using pattern matching - Regenerate both MsSql and DwSql configs with proper formatting - Update configuration test snapshots
1 parent bd129d9 commit bf781c6

7 files changed

+6636
-7025
lines changed

config-generators/config-generator.ps1

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ foreach($databaseType in $databaseTypes){
7474
# Post-process MsSql and DwSql configs to fix stored procedure GraphQL operations
7575
# The CLI currently ignores --graphql.operation parameter for stored procedures,
7676
# defaulting them to 'mutation'. We manually fix specific procedures that should be 'query'.
77+
# Using text-based replacement to preserve original JSON formatting.
7778
if($databaseType -eq "mssql" -or $databaseType -eq "dwsql"){
78-
$configContent = Get-Content $configFile -Raw | ConvertFrom-Json;
79-
if($configContent.entities.GetBooks){
80-
$configContent.entities.GetBooks.graphql.operation = "query";
81-
}
82-
if($configContent.entities.GetPublisher){
83-
$configContent.entities.GetPublisher.graphql.operation = "query";
84-
}
85-
$configContent | ConvertTo-Json -Depth 100 | Set-Content $configFile -Encoding UTF8;
79+
$configContent = Get-Content $configFile -Raw;
80+
# Fix GetBooks operation within its entity block
81+
$configContent = $configContent -replace '("GetBooks"[\s\S]*?"graphql"[\s\S]*?"operation":\s*)"mutation"', '$1"query"';
82+
# Fix GetPublisher operation within its entity block
83+
$configContent = $configContent -replace '("GetPublisher"[\s\S]*?"graphql"[\s\S]*?"operation":\s*)"mutation"', '$1"query"';
84+
Set-Content $configFile $configContent -Encoding UTF8 -NoNewline;
8685
}
8786
}

src/Service.Tests/dab-config.DwSql.json

Lines changed: 2752 additions & 2870 deletions
Large diffs are not rendered by default.

src/Service.Tests/dab-config.MsSql.json

Lines changed: 3877 additions & 4147 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)