From 6ec106e5f6f6ad6a08bcf05c3740a8893c6bd2d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 22:39:04 +0000 Subject: [PATCH 1/6] Initial plan From 6a2383343fe249323a4af7e0d63d32337111c017 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 22:57:30 +0000 Subject: [PATCH 2/6] Add missing level property to entity cache schema Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com> --- schemas/dab.draft.schema.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/schemas/dab.draft.schema.json b/schemas/dab.draft.schema.json index 920c0a4da6..fcdde13570 100644 --- a/schemas/dab.draft.schema.json +++ b/schemas/dab.draft.schema.json @@ -1119,6 +1119,12 @@ "type": "integer", "description": "Time to live in seconds", "default": 5 + }, + "level": { + "type": "string", + "description": "Cache level (L1 or L1L2)", + "enum": [ "L1", "L1L2", null ], + "default": "L1L2" } } }, From e1e7b7cc0cd9b3bcafc948aed2bbe8984ce251fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 19:33:47 +0000 Subject: [PATCH 3/6] Fix ttl-seconds schema to align with template cache section Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com> --- schemas/dab.draft.schema.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/schemas/dab.draft.schema.json b/schemas/dab.draft.schema.json index fcdde13570..b636d1bdb5 100644 --- a/schemas/dab.draft.schema.json +++ b/schemas/dab.draft.schema.json @@ -1116,9 +1116,10 @@ "default": false }, "ttl-seconds": { - "type": "integer", + "type": [ "integer", "null" ], "description": "Time to live in seconds", - "default": 5 + "default": 5, + "minimum": 1 }, "level": { "type": "string", From 5ab846abfa8329b812b155acbe88394151136b7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 22:15:24 +0000 Subject: [PATCH 4/6] Remove null from level enum and add schema validation tests Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com> --- schemas/dab.draft.schema.json | 4 +- .../Configuration/ConfigurationTests.cs | 57 +++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/schemas/dab.draft.schema.json b/schemas/dab.draft.schema.json index cefb492364..e08f7be151 100644 --- a/schemas/dab.draft.schema.json +++ b/schemas/dab.draft.schema.json @@ -813,7 +813,7 @@ "level": { "type": "string", "description": "Cache level (L1 or L1L2)", - "enum": [ "L1", "L1L2", null ], + "enum": [ "L1", "L1L2" ], "default": "L1L2" } } @@ -1137,7 +1137,7 @@ "level": { "type": "string", "description": "Cache level (L1 or L1L2)", - "enum": [ "L1", "L1L2", null ], + "enum": [ "L1", "L1L2" ], "default": "L1L2" } } diff --git a/src/Service.Tests/Configuration/ConfigurationTests.cs b/src/Service.Tests/Configuration/ConfigurationTests.cs index 9df54be519..a704f22e4d 100644 --- a/src/Service.Tests/Configuration/ConfigurationTests.cs +++ b/src/Service.Tests/Configuration/ConfigurationTests.cs @@ -1966,6 +1966,63 @@ public void TestBasicConfigSchemaWithNoEntityFieldsIsInvalid() Assert.IsTrue(result.ErrorMessage.Contains("Total schema validation errors: 1\n> Required properties are missing from object: entities.")); } + /// + /// Validates that the JSON schema correctly validates entity cache configuration properties. + /// Tests both valid configurations (proper level values, ttl >= 1) and invalid configurations + /// (invalid level values, ttl = 0). + /// + [DataTestMethod] + [DataRow("L1", 10, true, DisplayName = "Valid cache config with L1 and ttl=10")] + [DataRow("L1L2", 1, true, DisplayName = "Valid cache config with L1L2 and minimum ttl=1")] + [DataRow("L1L2", 3600, true, DisplayName = "Valid cache config with L1L2 and ttl=3600")] + [DataRow("L3", 10, false, DisplayName = "Invalid cache config with invalid level L3")] + [DataRow("L1", 0, false, DisplayName = "Invalid cache config with ttl=0 (below minimum)")] + [DataRow("L1L2", -1, false, DisplayName = "Invalid cache config with negative ttl")] + public void TestEntityCacheSchemaValidation(string level, int ttlSeconds, bool shouldBeValid) + { + string jsonData = $@"{{ + ""$schema"": ""https://github.com/Azure/data-api-builder/releases/download/vmajor.minor.patch/dab.draft.schema.json"", + ""data-source"": {{ + ""database-type"": ""mssql"", + ""connection-string"": ""Server=test;Database=test;"" + }}, + ""entities"": {{ + ""Book"": {{ + ""source"": {{ + ""object"": ""books"", + ""type"": ""table"" + }}, + ""permissions"": [{{ + ""role"": ""anonymous"", + ""actions"": [""read""] + }}], + ""cache"": {{ + ""enabled"": true, + ""ttl-seconds"": {ttlSeconds}, + ""level"": ""{level}"" + }} + }} + }} + }}"; + + Mock> schemaValidatorLogger = new(); + string jsonSchema = File.ReadAllText("dab.draft.schema.json"); + JsonConfigSchemaValidator jsonSchemaValidator = new(schemaValidatorLogger.Object, new MockFileSystem()); + + JsonSchemaValidationResult result = jsonSchemaValidator.ValidateJsonConfigWithSchema(jsonSchema, jsonData); + + if (shouldBeValid) + { + Assert.IsTrue(result.IsValid, $"Expected valid config but got errors: {result.ErrorMessage}"); + Assert.IsTrue(EnumerableUtilities.IsNullOrEmpty(result.ValidationErrors)); + } + else + { + Assert.IsFalse(result.IsValid, "Expected validation to fail but it passed"); + Assert.IsFalse(EnumerableUtilities.IsNullOrEmpty(result.ValidationErrors)); + } + } + /// /// This test tries to validate a runtime config file that is not compliant with the runtime config JSON schema. /// It validates no additional properties are defined in the config file. From 2a3d851108a1a4d7e43d7d313036de54c0846f14 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 22:19:40 +0000 Subject: [PATCH 5/6] Final validation - all tests pass and security check complete Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com> --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 17811390a4..1bdb496ef0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.418", + "version": "8.0.417", "rollForward": "latestFeature" } } From 0122515162d54d6a3bca61fe5dcfb4a4b2fcc811 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Feb 2026 05:11:59 +0000 Subject: [PATCH 6/6] Revert accidental SDK version change in global.json Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com> --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 1bdb496ef0..17811390a4 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.417", + "version": "8.0.418", "rollForward": "latestFeature" } }