Port to jsonschema 4

Context

jsonschema 4.0.0 removes the legacy mechanism to specify types to validators. This currently breaks BuildGrid:

  File "buildgrid/_app/settings/parser.py", line 1652, in get_validator
    return BgdValidator(schema, types=types)
TypeError: __init__() got an unexpected keyword argument 'types'

From the jsonschema release notes:

Code surrounding DEFAULT_TYPES and the legacy mechanism for specifying types to validators have been removed, as per the deprecation policy. Validators should use the TypeChecker object to customize the set of Python types corresponding to JSON Schema types.

Task Description

Describe the steps to take / implementation plan. If it's a bug, do you know how it may be tackled?

  • Use TypeChecker.redefine / jsonschema.validators.extend instead of the types keyword argument
  • Unpin jsonschema in requirements, verify BuildGrid works with jsonschema 4