Skip to content

Commit 13d80c4

Browse files
committed
Update model.py and schema.json to enhance quality checks; bump version to 1.2.1
1 parent 597c1a6 commit 13d80c4

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "datacontract-specification"
3-
version = "1.2.0" # in sync with spec
3+
version = "1.2.1" # in sync with spec
44
description = "The Pydantic Model of the Data Contract Specification"
55
readme = "README.md"
66
authors = [

src/datacontract_specification/model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,16 @@ class Definition(pyd.BaseModel):
172172
class Quality(pyd.BaseModel):
173173
type: str | None = None
174174
description: str | None = None
175+
metric: str | None = None
176+
arguments: Dict[str, Any] | None = None
175177
query: str | None = None
176178
dialect: str | None = None
177179
mustBe: float | int | None = None
178180
mustNotBe: float | int | None = None
179181
mustBeGreaterThan: float | int | None = None
180-
mustBeGreaterThanOrEqualTo: float | int | None = None
182+
mustBeGreaterOrEqualTo: float | int | None = None
181183
mustBeLessThan: float | int | None = None
182-
mustBeLessThanOrEqualTo: float | int | None = None
184+
mustBeLessOrEqualTo: float | int | None = None
183185
mustBeBetween: List[float | int] = None
184186
mustNotBeBetween: List[float | int] = None
185187
engine: str | None = None

src/datacontract_specification/schema.json

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"type": "string",
88
"title": "DataContractSpecificationVersion",
99
"enum": [
10+
"1.2.1",
1011
"1.2.0",
1112
"1.1.0",
1213
"0.9.3",
@@ -1816,13 +1817,21 @@
18161817
"mustBeGreaterThan": {
18171818
"type": "number"
18181819
},
1819-
"mustBeGreaterThanOrEqualTo": {
1820+
"mustBeGreaterOrEqualTo": {
18201821
"type": "number"
18211822
},
1823+
"mustBeGreaterThanOrEqualTo": {
1824+
"type": "number",
1825+
"deprecated": true
1826+
},
18221827
"mustBeLessThan": {
18231828
"type": "number"
18241829
},
18251830
"mustBeLessThanOrEqualTo": {
1831+
"type": "number",
1832+
"deprecated": true
1833+
},
1834+
"mustBeLessOrEqualTo": {
18261835
"type": "number"
18271836
},
18281837
"mustBeBetween": {
@@ -1849,18 +1858,42 @@
18491858
},
18501859
{
18511860
"if": {
1852-
"properties": {
1853-
"type": {
1854-
"const": "library"
1861+
"anyOf": [
1862+
{
1863+
"properties": {
1864+
"type": {
1865+
"const": "library"
1866+
}
1867+
}
1868+
},
1869+
{
1870+
"properties": {
1871+
"metric": {
1872+
"type": "string"
1873+
}
1874+
},
1875+
"required": ["metric"]
18551876
}
1856-
}
1877+
]
18571878
},
18581879
"then": {
18591880
"properties": {
1881+
"metric": {
1882+
"type": "string",
1883+
"description": "The DataQualityLibrary metric to use for the quality check.",
1884+
"enum": ["nullValues", "missingValues", "invalidValues", "duplicateValues", "rowCount"]
1885+
},
18601886
"rule": {
18611887
"type": "string",
1862-
"description": "Define a data quality check based on the predefined rules as per ODCS.",
1863-
"examples": ["duplicateCount", "validValues", "rowCount"]
1888+
"deprecated": true,
1889+
"description": "Deprecated. Use metric instead"
1890+
},
1891+
"arguments": {
1892+
"type": "object",
1893+
"description": "Additional metric-specific parameters for the quality check.",
1894+
"additionalProperties": {
1895+
"type": ["string", "number", "boolean", "array", "object"]
1896+
}
18641897
},
18651898
"mustBe": {
18661899
"description": "Must be equal to the value to be valid. When using numbers, it is equivalent to '='."
@@ -1906,7 +1939,7 @@
19061939
}
19071940
},
19081941
"required": [
1909-
"rule"
1942+
"metric"
19101943
]
19111944
}
19121945
},
@@ -2022,4 +2055,4 @@
20222055
]
20232056
}
20242057
}
2025-
}
2058+
}

0 commit comments

Comments
 (0)