web-platform-tests / web-platform-tests/wpt
DeprecationWarning from jsonschema
Open
Nobody has claimed this yet.
ci
infra
priority:backlog
- Dominant language
- HTML
- Stars
- 6.2k
- Forks
- 3.9k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 586
Description
The problem here is that https://community-tc.services.mozilla.com/schemas/common/metaschema.json isn't a known metaschema, and jsonschema doesn't try to resolve $ref by default.
ci/tc/tests/test_valid.py:93: in test_verify_payload
validate(instance=task_data, schema=create_task_schema)
.tox/py311/lib/python3.11/site-packages/jsonschema/validators.py:1115: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$id': 'https://community-tc.services.mozilla.com/schemas/queue/v1/create-task-request.json#', '$schema': 'https://co...n/metaschema.json#', 'additionalProperties': False, 'description': 'Definition of a task that can be scheduled\n', ...}
default = <unset>
def validator_for(schema, default=_UNSET):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :kw:`$schema` keyword that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.abc.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class
cannot be determined.
If unprovided, the default is to return the latest supported
draft.
"""
DefaultValidator = _LATEST_VERSION if default is _UNSET else default
if schema is True or schema is False or "$schema" not in schema:
return DefaultValidator
if schema["$schema"] not in _META_SCHEMAS:
if default is _UNSET:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ci/tc/tests/test_valid.py:93 and the create_task_schema definition, then run test_verify_payload to reproduce the jsonschema warning. Trace how the schema and its $schema reference are loaded; done means the test still validates the payload without emitting the reported DeprecationWarning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ci-cd, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100