Report nested types as a separate check in datacontract test#1382
Merged
Conversation
A property that declares children via `properties:` or `items:` now gets its own `field_nested_type` / `field_nested_physical_type` check next to the base type check, which only compares the column's own type. Nested failures name the full path and carry the complete error list in the check diagnostics. Dynamically typed columns (json/variant/jsonb) warn instead of failing, since their structure cannot be read. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cture cannot be read A property whose declared type is not an object or array (a vendor type such as MAP(VARCHAR, VARCHAR), or a scalar carrying a stray items:) no longer gets a nested check it could never verify. Children that sit in a dynamically typed part of a column (variant, json, untyped object/array) now warn instead of failing; a real mismatch anywhere still fails. The check's expected label renders the declared children, and its reason no longer repeats the column's own structure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On Snowflake the nested types recovered from SHOW COLUMNS now carry their native type down the whole tree, so a declared child physicalType is compared against the column's real one with the same comparator the base check uses: VARCHAR still matches VARCHAR(10), VARCHAR(64) no longer does. Previously a nested physicalType was only compared as a coarse logical category, so a wrong length silently passed. A physicalType that is merely a logical keyword (string, boolean, struct) names no native type and is compared as a category, but it can no longer be overruled by a contradicting logicalType next to it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ARCHAR Snowflake's INFORMATION_SCHEMA reports a VARCHAR column as TEXT, and the two parse to different sqlglot types, so a contract declaring VARCHAR never matched its own column. They are synonyms in Snowflake (unlike MySQL or SQL Server, where TEXT and VARCHAR are distinct types), so they are now treated as one type for that dialect. A declared length is still enforced. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…logical type keyword A physicalType of NUMBER, DATE or BOOLEAN was compared as a type category, so a declared NUMBER passed on a FLOAT column. Snowflake type aliases now match the name the catalog reports, and a physicalType without precision no longer inherits the default sqlglot fills in. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
A property that declares children via
properties:/items:now gets its own check line next to the base type check:The base check compares only the column's own type; the nested check walks the declared tree and names the full path on failure. Dynamically typed columns (json/variant/jsonb) warn instead of failing, since their structure cannot be read.
On Snowflake, a
physicalTypedeclared on a nested property is checked against the column's real native type, read fromSHOW COLUMNS.🤖 Generated with Claude Code