diff --git a/bindings/python/CHANGELOG.md b/bindings/python/CHANGELOG.md index 59ef70c..fc81e7d 100644 --- a/bindings/python/CHANGELOG.md +++ b/bindings/python/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changed +- Expose drafts 2019-09 and 2020-12 to Python - Update `pyo3` to `0.20`. ## [0.17.1] - 2023-07-05 diff --git a/bindings/python/python/jsonschema_rs/__init__.pyi b/bindings/python/python/jsonschema_rs/__init__.pyi index a7a7184..6bcec76 100644 --- a/bindings/python/python/jsonschema_rs/__init__.pyi +++ b/bindings/python/python/jsonschema_rs/__init__.pyi @@ -67,3 +67,5 @@ class ValidationError(ValueError): Draft4: int Draft6: int Draft7: int +Draft201909: int +Draft202012: int diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index b67465c..a568cb0 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -34,6 +34,8 @@ mod types; const DRAFT7: u8 = 7; const DRAFT6: u8 = 6; const DRAFT4: u8 = 4; +const DRAFT201909: u8 = 19; +const DRAFT202012: u8 = 20; /// An instance is invalid under a provided schema. #[pyclass(extends=exceptions::PyValueError, module="jsonschema_rs")] @@ -117,6 +119,8 @@ fn get_draft(draft: u8) -> PyResult { DRAFT4 => Ok(jsonschema::Draft::Draft4), DRAFT6 => Ok(jsonschema::Draft::Draft6), DRAFT7 => Ok(jsonschema::Draft::Draft7), + DRAFT201909 => Ok(jsonschema::Draft::Draft201909), + DRAFT202012 => Ok(jsonschema::Draft::Draft202012), _ => Err(exceptions::PyValueError::new_err(format!( "Unknown draft: {}", draft @@ -462,6 +466,8 @@ fn jsonschema_rs(py: Python<'_>, module: &PyModule) -> PyResult<()> { module.add("Draft4", DRAFT4)?; module.add("Draft6", DRAFT6)?; module.add("Draft7", DRAFT7)?; + module.add("Draft201909", DRAFT201909)?; + module.add("Draft202012", DRAFT202012)?; // Add build metadata to ease triaging incoming issues module.add("__build__", pyo3_built::pyo3_built!(py, build))?;