You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generalize Nullable model to support arbitrary context keys
The Nullable model previously hardcoded three healthcare LOBs (MD, MP, ME).
Now uses Pydantic's extra="allow" to accept any context keys, making
tablespec usable across domains (regional, environmental, etc.) while
maintaining full backward compatibility with existing YAML files.
Model changes:
- Nullable uses ConfigDict(extra="allow") instead of fixed fields
- is_nullable_for_all_contexts() iterates dynamic fields via model_dump()
- JSON schema updated to use additionalProperties instead of fixed props
Consumer updates:
- Renamed lob/lobs variables to context/contexts across prompts, GX
baseline, generators, validators
- Updated docstrings from "LOB-aware" to "context-aware"
- Excel converter keeps MD/MP/ME as default presentation columns
Tests:
- 4 new tests for custom contexts, mixed contexts, model_dump behavior
- All 1889 tests passing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/tablespec/schemas/umf.schema.json
+5-43Lines changed: 5 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -741,50 +741,12 @@
741
741
"type": "object"
742
742
},
743
743
"Nullable": {
744
-
"description": "Nullable configuration per Line of Business.",
745
-
"properties": {
746
-
"MD": {
747
-
"anyOf": [
748
-
{
749
-
"type": "boolean"
750
-
},
751
-
{
752
-
"type": "null"
753
-
}
754
-
],
755
-
"default": null,
756
-
"description": "Nullable for Medicaid",
757
-
"title": "Md"
758
-
},
759
-
"MP": {
760
-
"anyOf": [
761
-
{
762
-
"type": "boolean"
763
-
},
764
-
{
765
-
"type": "null"
766
-
}
767
-
],
768
-
"default": null,
769
-
"description": "Nullable for Medicare Part D",
770
-
"title": "Mp"
771
-
},
772
-
"ME": {
773
-
"anyOf": [
774
-
{
775
-
"type": "boolean"
776
-
},
777
-
{
778
-
"type": "null"
779
-
}
780
-
],
781
-
"default": null,
782
-
"description": "Nullable for Medicare",
783
-
"title": "Me"
784
-
}
744
+
"description": "Nullable configuration per context. Keys are context identifiers (e.g., MD, MP, ME for healthcare LOBs), values are booleans indicating whether the column is nullable in that context.",
745
+
"type": "object",
746
+
"additionalProperties": {
747
+
"type": "boolean"
785
748
},
786
-
"title": "Nullable",
787
-
"type": "object"
749
+
"title": "Nullable"
788
750
},
789
751
"OutgoingRelationship": {
790
752
"description": "Outgoing foreign key relationship to another table.",
0 commit comments