[Phase 2] Enable MSSQL JSON data type - type mapping & error codes (engine)#3691
Draft
souvikghosh04 wants to merge 1 commit into
Draft
[Phase 2] Enable MSSQL JSON data type - type mapping & error codes (engine)#3691souvikghosh04 wants to merge 1 commit into
souvikghosh04 wants to merge 1 commit into
Conversation
4edabac to
6bed2da
Compare
…s (Phase 2) Treat SQL Server 2025+ JSON columns exactly like string columns (2026-06-09 design, issue #2768). Engine-only change validated by unit tests. - TypeHelper._sqlDbTypeToType[SqlDbType.Json] = typeof(string) (T004) - SqlTypeConstants: register json as supported literal (T004) - MsSqlDbExceptionParser BadRequestExceptionCodes += 13608-13614 so SQL JSON errors map to HTTP 400 (T006) - unit tests for json type mapping and 400 error mapping (T005/T007) The profiles DB fixture (T002) and Profile config entity (T003) are DEFERRED to Phase 3: the native json type requires SQL Server 2025+/Azure SQL and cannot be created on the LocalDB engine used by CI. They ship with the Phase 3 integration tests behind server-version gating. No changes to PostgreSQL/MySQL/DwSql/CosmosDB (FR-012).
6bed2da to
9e5a38d
Compare
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.
Phase 2 — MSSQL JSON engine enablement
Part of the phased delivery for MSSQL
JSONdata type support (issue #2768).Microsoft.Data.SqlClient6.x upgrade (#3656)What this delivers
Treats a SQL Server 2025+
JSONcolumn exactly like astringcolumn (per the 2026-06-09 design). This PR is the engine-only change, validated entirely by unit tests (no database dependency).Production change (2 lines):
TypeHelper._sqlDbTypeToType[SqlDbType.Json] = typeof(string)— JSON columns flow through every existing string read/write path. (T004)MsSqlDbExceptionParser.BadRequestExceptionCodes += 13608–13614— SQL Server JSON-validation errors surface as HTTP400instead of500. (T006)Supporting changes:
SqlTypeConstants: registerjsonas a supported SqlDbType literal. (T004)json→stringtype mapping, and JSON error codes →400. (T005 / T007)Why the DB fixture is NOT in this PR
The
profilestest table (T002) and theProfileconfig entity (T003) are deferred to Phase 3. The nativejsoncolumn type requires SQL Server 2025+ / Azure SQL, and the CI test job initializesDatabaseSchema-MsSql.sqlagainst LocalDB (SQL 2022 max), which does not know thejsontype —CREATE TABLE profiles (metadata json ...)fails schema init for the entire MsSql suite. Since no Phase 2 test consumes that table, the fixture ships with the Phase 3 integration tests behind server-version gating (see T031). This keeps Phase 2 green on the existing CI engine.Requirements covered
FR-004, FR-007, FR-014 (schema-surface FR-001 is exercised by the Phase 3 integration tests).
Non-goals / out of scope
Testing
dotnet build src/Service.Tests/Azure.DataApiBuilder.Service.Tests.csproj— succeeds, 0 warnings.JsonSqlDbTypeResolvesToString,TestJsonValidationErrorsMapToBadRequest(8 cases).TestCategory=MsSqlintegration run arrives with Phase 3 (requires SQL Server 2025+).Draft rationale
Opened as draft — the feature is not functionally verifiable end-to-end until the Phase 3 integration tests run against a SQL Server 2025+ environment, and the error-code list is finalized in Phase 4.