diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 071c42c4..b59819b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -87,7 +87,7 @@ repos: - subprocess-tee>=0.4.1 - "typing-extensions>=4.5.0;python_version<'3.10'" - types-PyYAML - - types-pkg_resources + - types-setuptools - types-jsonschema>=4.4.9 - repo: https://github.com/pycqa/pylint rev: v3.2.4 diff --git a/src/ansible_compat/schema.py b/src/ansible_compat/schema.py index fb411f73..c1dd33cc 100644 --- a/src/ansible_compat/schema.py +++ b/src/ansible_compat/schema.py @@ -102,8 +102,8 @@ def validate( data_path=to_path(validation_error.absolute_path), json_path=json_path(validation_error.absolute_path), schema_path=to_path(validation_error.schema_path), - relative_schema=validation_error.schema, - expected=validation_error.validator_value, + relative_schema=str(validation_error.schema), + expected=str(validation_error.validator_value), validator=str(validation_error.validator), found=str(validation_error.instance), ) diff --git a/test/assets/validate0_expected.json b/test/assets/validate0_expected.json index ea36da99..50bc4fd1 100644 --- a/test/assets/validate0_expected.json +++ b/test/assets/validate0_expected.json @@ -4,7 +4,7 @@ "data_path": "environment.a", "json_path": "$.environment.a", "schema_path": "properties.environment.additionalProperties.type", - "relative_schema": { "type": "string" }, + "relative_schema": "{'type': 'string'}", "expected": "string", "validator": "type", "found": "False" @@ -14,7 +14,7 @@ "data_path": "environment.b", "json_path": "$.environment.b", "schema_path": "properties.environment.additionalProperties.type", - "relative_schema": { "type": "string" }, + "relative_schema": "{'type': 'string'}", "expected": "string", "validator": "type", "found": "True"