Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bump jsonschema to 4.24.* #14166

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

Merged
merged 4 commits into from
May 27, 2025
Merged

Bump jsonschema to 4.24.* #14166

merged 4 commits into from
May 27, 2025

Conversation

donBarbos
Copy link
Contributor

@donBarbos donBarbos commented May 27, 2025

Closes: #14162

Actually _utils.is_valid function was added

This comment has been minimized.

stubs/jsonschema/jsonschema/_utils.pyi Outdated Show resolved Hide resolved
stubs/jsonschema/jsonschema/validators.pyi Outdated Show resolved Hide resolved
stubs/jsonschema/jsonschema/validators.pyi Outdated Show resolved Hide resolved
stubs/jsonschema/jsonschema/validators.pyi Outdated Show resolved Hide resolved
stubs/jsonschema/jsonschema/_utils.pyi Outdated Show resolved Hide resolved
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>

This comment has been minimized.


def validate(instance: object, schema: Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
def validator_for(schema: Schema | bool, default=...): ...
def validator_for(schema: Schema | bool, default: type[_Validator] | Unset = ...) -> type[_Validator]: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the primer output, we probably need to to ._protocols.Validator here, like the implementation does.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
+ src/check_jsonschema/formats/__init__.py:57: error: Argument "default" to "validator_for" has incompatible type "type[Draft202012Validator]"; expected "type[Validator] | Unset"  [arg-type]
+ src/check_jsonschema/schema_loader/main.py:190: error: Unexpected keyword argument "registry" for "Validator"  [call-arg]
+ src/check_jsonschema/schema_loader/main.py:195: error: Redundant cast to "Validator"  [redundant-cast]

schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/specs/openapi/references.py:71: error: Call to untyped function "resolve" in typed context  [no-untyped-call]
- src/schemathesis/specs/openapi/security.py:141: error: Call to untyped function (unknown) in typed context  [no-untyped-call]
- src/schemathesis/specs/openapi/security.py:143: error: Call to untyped function (unknown) in typed context  [no-untyped-call]
- src/schemathesis/specs/openapi/stateful/links.py: note: In function "add_link":
- src/schemathesis/specs/openapi/stateful/links.py:249: error: Call to untyped function "resolve" in typed context  [no-untyped-call]

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably just get rid of the legacy _Validator class. (I think it precedes the introduction of the Validator protocol upstream.) But this is outside the scope of this PR.

@srittau srittau merged commit 295d06e into python:main May 27, 2025
49 checks passed
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.