Skip to content

Commit b135913

Browse files
authored
[BugFix] Handle configs which have missing options for MsSql (#1580)
## Why make this change? - With the recent refactor #1402, if `options` property is not specified in the config, after deserialization the `Options` dictionary of `DataSource` object is `null` - This leads to a null dereference when trying to `GetTypedOptions(MsSqlOptions)` [here](https://github.com/Azure/data-api-builder/blob/bda0d6551f8f75fc7b98f888bdfce1f3dd317378/src/Core/Resolvers/MsSqlQueryExecutor.cs#L76C70-L76C70). ## What is this change? - Make `Options` a nullable property since its not required as per the schema. - Handle all the instances of Options considering it could be null. ## How was this tested? - Manually running dab. - Automated tests: 1. Removed the `options: set-session-context` from the initial config used in the CLI tests to verify deserialization results in a null `Options` dictionary as demonstrated by the Snapshots 2. Modified tests which create a custom config and start the engine by setting `Options` to null and verifying those continue to pass. Note: The checked in configuration file for MsSql sets the session context to true for integration tests of row level security feature. So, did not modify that file even though options is optional for MsSql.
1 parent fc257d4 commit b135913

File tree

63 files changed

+130
-379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+130
-379
lines changed

src/Cli.Tests/Snapshots/AddEntityTests.AddEntityWithAnExistingNameButWithDifferentCase.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddEntityWithPolicyAndFieldProperties_70de36ebf1478d0d.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddEntityWithPolicyAndFieldProperties_9f612e68879149a3.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddEntityWithPolicyAndFieldProperties_bea2d26f3e5462d8.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddNewEntityWhenEntitiesEmpty.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddNewEntityWhenEntitiesNotEmpty.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.AddNewEntityWhenEntitiesWithSourceAsStoredProcedure.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.TestAddNewSpWithDifferentRestAndGraphQLOptions_0c9cbb8942b4a4e5.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.TestAddNewSpWithDifferentRestAndGraphQLOptions_286d268a654ece27.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

src/Cli.Tests/Snapshots/AddEntityTests.TestAddNewSpWithDifferentRestAndGraphQLOptions_3048323e01b42681.verified.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
DataSource: {
3-
DatabaseType: MSSQL,
4-
Options: {
5-
set-session-context: {
6-
ValueKind: True
7-
}
8-
}
3+
DatabaseType: MSSQL
94
},
105
Runtime: {
116
Rest: {

0 commit comments

Comments
 (0)