From fbd11f7a487a2366ede1b4351f8ebbd919b6b548 Mon Sep 17 00:00:00 2001 From: Tanwi Geetika Date: Wed, 7 Aug 2024 12:53:59 +0530 Subject: [PATCH 1/3] Updating types-pkg_resources to types-setuptools and type casting relative schema to str --- .pre-commit-config.yaml | 2 +- src/ansible_compat/constants.py | 4 ++-- src/ansible_compat/schema.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 071c42c..b59819b 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/constants.py b/src/ansible_compat/constants.py index f5335ab..50b505e 100644 --- a/src/ansible_compat/constants.py +++ b/src/ansible_compat/constants.py @@ -33,8 +33,8 @@ role_name: my_name # if absent directory name hosting role is used instead namespace: my_galaxy_namespace # if absent, author is used instead -Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations -Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names +Namespace: https://ansible.readthedocs.io/projects/galaxy-ng/en/latest/usage_guide/collections/#namespaces +Role: https://ansible.readthedocs.io/projects/galaxy-ng/en/latest/dev/developer_guide/rbac/?h=creating+role#role-assignment As an alternative, you can add 'role-name' to either skip_list or warn_list. """ diff --git a/src/ansible_compat/schema.py b/src/ansible_compat/schema.py index fb411f7..c1dd33c 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), ) From a9cba26875b859e97b0fd3c532d8357f7d0d0f7d Mon Sep 17 00:00:00 2001 From: Ajinkya Udgirkar Date: Mon, 12 Aug 2024 16:30:58 +0530 Subject: [PATCH 2/3] Fix failing test --- test/assets/validate0_expected.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/assets/validate0_expected.json b/test/assets/validate0_expected.json index ea36da9..50bc4fd 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" From e7bed632cb7f683860d0e527191c5b53ff732c9f Mon Sep 17 00:00:00 2001 From: tanwigeetika1618 <84617407+tanwigeetika1618@users.noreply.github.com> Date: Mon, 12 Aug 2024 19:09:48 +0530 Subject: [PATCH 3/3] Undo constants.py changes --- src/ansible_compat/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansible_compat/constants.py b/src/ansible_compat/constants.py index 50b505e..f5335ab 100644 --- a/src/ansible_compat/constants.py +++ b/src/ansible_compat/constants.py @@ -33,8 +33,8 @@ role_name: my_name # if absent directory name hosting role is used instead namespace: my_galaxy_namespace # if absent, author is used instead -Namespace: https://ansible.readthedocs.io/projects/galaxy-ng/en/latest/usage_guide/collections/#namespaces -Role: https://ansible.readthedocs.io/projects/galaxy-ng/en/latest/dev/developer_guide/rbac/?h=creating+role#role-assignment +Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations +Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names As an alternative, you can add 'role-name' to either skip_list or warn_list. """