[Phase 4] MSSQL JSON - malformed-JSON (400) + filter edge-case tests - #3751
Open
souvikghosh04 wants to merge 3 commits into
Open
[Phase 4] MSSQL JSON - malformed-JSON (400) + filter edge-case tests#3751souvikghosh04 wants to merge 3 commits into
souvikghosh04 wants to merge 3 commits into
Conversation
…sts (Phase 4) Covers the JSON error-handling and filter user stories from #2768: - 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). - US9 REST: FilterJsonColumnIsNotNull_Succeeds - filtering a json column as a string (metadata ne null) passes through to SQL and returns the 4 non-null rows.
3 tasks
souvikghosh04
marked this pull request as ready for review
August 4, 2026 08:20
souvikghosh04
requested review from
Alekhya-Polavarapu,
Aniruddh25,
JerryNixon,
RubenCerna2079,
aaronburtle,
anushakolan,
rusamant,
sourabh1007,
stuartpa and
vadeveka
as code owners
August 4, 2026 08:20
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Phase 4 integration coverage for SQL Server 2025 native json columns, validating malformed-JSON error handling and a REST filter edge case to ensure DAB continues treating json as a normal string while surfacing database validation errors as client-facing failures.
Changes:
- Added REST test coverage for
$filter=metadata ne null(IS NOT NULL behavior) onjsoncolumns. - Added REST test coverage ensuring malformed JSON inserts are surfaced as HTTP 400 (not 500).
- Added GraphQL mutation test coverage ensuring malformed JSON creates fail with a GraphQL error.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Service.Tests/SqlTests/RestApiTests/MsSqlRestJsonTypesTests.cs | Adds REST tests for json column filter IS NOT NULL behavior and HTTP 400 mapping on malformed JSON inserts. |
| src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLJsonSchemaTests.cs | Adds GraphQL mutation test for malformed JSON create failure behavior. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3752
Why
Phase 4 of MSSQL native
JSONsupport (#2768) — error-handling and filter edge cases. Builds on the merged engine + schema-discovery work (#3691, #3720, #3738).What
InsertMalformedJson_ReturnsBadRequestjsoncolumn is rejected by SQL Server and surfaced as HTTP 400 (not 500), exercising the13608–13614 → BadRequestmappingJsonColumn_GraphQLCreateWithMalformedJson_FailscreateProfilemutation with malformed JSON fails with a GraphQL error (mirrors the merged vector-type pattern inMsSqlGraphQLVectorTypesTests)FilterJsonColumnIsNotNull_Succeedsjsoncolumn as a string ($filter=metadata ne null) passes through to SQL and returns the 4 non-null rowsBecause DAB treats
jsonas 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)
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.jsoncolumn: SQL Server disallows comparing/sorting the nativejsontype (exceptIS [NOT] NULL), so$orderby=metadata/metadata eq '…'behavior + error-code mapping needs CI confirmation before I assert on it.Notes
json); CI already runs SQL 2025.Delivery plan