Skip to content

adding test_check_schema_builtin #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Borda
Copy link
Contributor

@Borda Borda commented Apr 3, 2025

adding test for #550

cc: @sirosen @edgarrmondragon

@Borda Borda force-pushed the fix/test_check_schema_builtin branch from 27bbb86 to 1263dd2 Compare April 3, 2025 15:36
@Borda Borda force-pushed the fix/test_check_schema_builtin branch from dfe78fc to c9c468f Compare April 3, 2025 15:37
@sirosen
Copy link
Member

sirosen commented Apr 7, 2025

Hi, thanks for the PR!

I'm still getting up to speed on the situation re #550. But the azure-pipelines hook is already declared with --regex-variant nonunicode.
And I think that must be working correctly since the acceptance tests for Azure are healthy; these pass:

tests/acceptance/test_example_files.py::test_hook_positive_examples[azure-pipelines/marshmallow.yaml]
tests/acceptance/test_example_files.py::test_hook_positive_examples[azure-pipelines/object-defined-by-expression-map.yaml]
tests/acceptance/test_example_files.py::test_hook_positive_examples[azure-pipelines/expression-from-lang-server.yaml]
tests/acceptance/test_example_files.py::test_hook_positive_examples[azure-pipelines/expression-transform.yaml]

I would very strongly prefer not including unrelated changes (e.g., changing something to an ABC) in something like this. If you think something internal should change, please make that as a separate PR and explain your rationale -- class hierarchies and other project structure should not change as mere side-effects of other changes.


I'm very unclear on what the new test is testing, since it doesn't seem to be reading the schema catalog data to determine which regex variant to use. Is this just a duplicate of the pre-commit hook which validates the vendored schemas?

- id: check-metaschema
name: Validate Vendored Schemas
files: ^src/check_jsonschema/builtin_schemas/vendor/.*\.json$
exclude: ^src/check_jsonschema/builtin_schemas/vendor/azure-pipelines\.json$
- id: check-metaschema
name: Validate Vendored Schemas (nonunicode regexes)
files: ^src/check_jsonschema/builtin_schemas/vendor/azure-pipelines\.json$
args: ["--regex-variant", "nonunicode"]

@Borda
Copy link
Contributor Author

Borda commented Apr 7, 2025

But the azure-pipelines hook is already declared with --regex-variant nonunicode

yes if you use it as a hook but but you call it with CLI and you are not aware of this specificity (could not find it and the error trace did not help either) you won't know what has happened or why it crashed...

I'm very unclear on what the new test is testing, since it doesn't seem to be reading the schema catalog data to determine which regex variant to use.

it is related to CLI not hooks... so from a user perspective if you use builtin schema the default shall be relevant to the selected schema, not that you need to select another argument...

about this PR, I did not find any validation that all builtin schemas are tested so at first added a test which helped me understand that default is not the right default for all schemas

@Borda
Copy link
Contributor Author

Borda commented Apr 7, 2025

I would very strongly prefer not including unrelated changes (e.g., changing something to an ABC) in something like this. If you think something internal should change, please make that as a separate PR and explain your rationale -- class hierarchies and other project structure should not change as mere side-effects of other changes.

sure I am happy to revert the abstraction change :)

@Borda Borda changed the title add/fix: test_check_schema_builtin adding test_check_schema_builtin Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants