Commit f8d556f
[Phase 4] MSSQL JSON - malformed-JSON (400) + filter edge-case tests (#3751)
Resolves #3752
## Why
Phase 4 of MSSQL native `JSON` support (#2768) — error-handling and
filter edge cases. Builds on the merged engine + schema-discovery work
(#3691, #3720, #3738).
## What
| User story | Test | Asserts |
|-----------|------|---------|
| **US7 — REST** | `InsertMalformedJson_ReturnsBadRequest` | Posting
invalid JSON for the `json` column is rejected by SQL Server and
surfaced as **HTTP 400** (not 500), exercising the `13608–13614 →
BadRequest` mapping |
| **US7 — GraphQL** | `JsonColumn_GraphQLCreateWithMalformedJson_Fails`
| A `createProfile` mutation with malformed JSON fails with a GraphQL
error (mirrors the merged vector-type pattern in
`MsSqlGraphQLVectorTypesTests`) |
| **US9 — REST** | `FilterJsonColumnIsNotNull_Succeeds` | Filtering a
`json` column as a string (`$filter=metadata ne null`) passes through to
SQL and returns the 4 non-null rows |
Because DAB treats `json` as a normal string and does no pre-validation,
invalid JSON is caught at the database boundary and mapped to a client
error — consistent with the "nothing special" contract.
## Deferred (pending CI observation)
- **Pruning `13608–13614`**: kept the full documented JSON-validation
range for now. Removing a code that actually fires would regress it to a
500, so I'd rather confirm the exact code(s) SQL 2025 emits (via this
PR's CI run) before narrowing the list.
- **Sort / equality on a `json` column**: SQL Server disallows
comparing/sorting the native `json` type (except `IS [NOT] NULL`), so
`$orderby=metadata` / `metadata eq '…'` behavior + error-code mapping
needs CI confirmation before I assert on it.
## Notes
- Tests only — no product code changes.
- Requires SQL Server 2025 / Azure SQL (native `json`); CI already runs
SQL 2025.
- Cannot be run locally (no SQL 2025 here) — relying on CI.
## Delivery plan
| Phase | What | Status |
|-------|------|--------|
| 1 | .NET 10 + SqlClient 6.x | ✅ Merged (#3697/#3656) |
| 2 | JSON type + error mapping (engine) | ✅ Merged (#3691) |
| 3 | Test fixture + REST CRUD tests | ✅ Merged (#3720) |
| 3b | json-as-string read fix + OpenAPI/GraphQL tests | ✅ Merged
(#3738) |
| **4** | **Error / filter edge cases (this PR)** | 🚧 |
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>1 parent d783120 commit f8d556f
2 files changed
Lines changed: 56 additions & 0 deletions
File tree
- src/Service.Tests/SqlTests
- GraphQLQueryTests
- RestApiTests
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
85 | 106 | | |
86 | 107 | | |
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
117 | 132 | | |
118 | 133 | | |
119 | 134 | | |
| |||
221 | 236 | | |
222 | 237 | | |
223 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
224 | 259 | | |
225 | 260 | | |
226 | 261 | | |
| |||
0 commit comments