Skip to content

Report nested types as a separate check in datacontract test#1382

Merged
jschoedl merged 5 commits into
mainfrom
nested-type-checks
Jul 14, 2026
Merged

Report nested types as a separate check in datacontract test#1382
jschoedl merged 5 commits into
mainfrom
nested-type-checks

Conversation

@jschoedl

@jschoedl jschoedl commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

A property that declares children via properties: / items: now gets its own check line next to the base type check:

Check that field my_field has physical type OBJECT
Check that nested physical types of my_field are correct

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 physicalType declared on a nested property is checked against the column's real native type, read from SHOW COLUMNS.

🤖 Generated with Claude Code

jschoedl and others added 5 commits July 14, 2026 16:54
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>
@jschoedl
jschoedl merged commit 70c45db into main Jul 14, 2026
15 checks passed
@jschoedl
jschoedl deleted the nested-type-checks branch July 14, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant