Features:
- Allow adding a source with a base URI of
None
to match full URIs as therelative_path
JSONPointer
andRelativeJSONPointer
now have class attributes defining the exceptions that they use, which can be overidden in subclasses- Cached properties for accessing document and resource root schemas from subschemas
Breaking changes:
RelativeJSONPointerError
superseded byRelativeJSONPointerMalformedError
andRelativeJSONPointerReferenceError
Deprecations:
- Exception classes dropped from the top-level package API
jschon.exceptions
module renamed tojschon.exc
Documentation:
- Exception classes documented
- Custom keyword example refactored to raise exception in constructor
Miscellaneous:
JschonError
base exception class introducedJSONPointerError
partitioned intoJSONPointerMalformedError
,JSONPointerReferenceError
,RelativeJSONPointerMalformedError
andRelativeJSONPointerReferenceError
Bug Fixes:
- Non-scalar annotation values are now fully unwrapped from the JSON class
Documentation:
- Spell 'meta-schema' consistently in tutorials and examples
Experimental:
- "$id" no longer allows empty fragments in draft-next
Bug Fixes:
- "$id" allows non-normalized URI references
- "$id" allows empty fragments in 2019-09 and 2020-12
Miscellaneous:
- Set default (2019-09, 2020-12) for
--testsuite-version
pytest option integer
is no longer considered a type for keyword evaluation restriction purposes- Drop
Keyword.can_evaluate()
method - Preload rather than implicit-load standard meta-schemas
Miscellaneous:
- Rename submodules json-schema-spec-2019-09 and json-schema-spec-2020-12 to
json-schema-2019-09 and json-schema-2020-12, respectively
(run
git submodule init
to update local git config) - LocalSource now includes the filename in the CatalogError when the file is not found
Features:
@format_validator
decorator- json-pointer format validator
- Annotation filtering for basic output format (#32)
- JSON
null
,true
,false
literals - Relative JSON Pointer
+
/-
array index adjustments - Unknown keywords are collected as annotations
- Automatically create metaschemas as referenced by
"$schema"
on first access of the now-cachedJSONSchema.metaschema
property - Automatically detect the core vocabulary in metaschemas, but allow specifying a default to use when none is detectable
Experimental:
- Catalog support for the next JSON Schema draft
- hierarchical output format
- In-place JSON Patch add, remove and replace operations on
JSON
class
Breaking changes:
Catalog.add_format_validators()
superseded by@format_validator
/Catalog.enable_formats()
- Rename
Catalog.session()
context manager toCatalog.cache()
- Rename
session
parameter tocacheid
in many places - Rename public functions in the
jsonpatch
module - Rename
*Applicator*
keyword class mixins to*Subschema*
Bug Fixes:
- "$dynamicRef" works with non-plain-name fragment URIs
- Fixed remote anchor ref resolution
Documentation:
- Rename User Guide to Tutorial
- Restructure the API docs index page
Miscellaneous:
@output_formatter
decorator now identifies output formats explicitly- Add
JSONCompatible
andResult
classes to the top-level package API - Remove implicit fall-through to looking up a schema in the __meta__ cache
if not found in the parameterized cache, in
Catalog.get_schema()
(#40) - Added
Catalog.get_metaschema()
, analogous toCatalog.get_schema()
Catalog.create_metaschema()
andCatalog.create_vocabulary()
return the created instance- Rename
core_vocabulary
andcore_vocabulary_uri
parameters forMetaschema.__init__()
andCatalog.create_metaschema()
respectively todefault_core_vocabulary
anddefault_core_vocabulary_uri
- Improve kwarg-based construction of
RelativeJSONPointer
- Rename
AnnotationKeyword
to_AnnotationKeyword
- Rename
vocabularies
parameter ofcreate_catalog()
toversions
- Allow passthrough of arguments to pytest when invoking tox
- Add pytest command line options
--testsuite-file
and--testsuite-description
- Python 3.11 is now tested (no changes were required to support it)
- Pinned
hypothesis<6.0.4
to avoid python/cpython#102126 in Python 3.10.10 and 3.11.2
Features:
- JSON array/object mutation
- JSON serialization to string/file
- JSON deserialization from remote location
Breaking changes:
- Rename Scope to Result
- Remove JSON support for decimal.Decimal (#31)
- Rename Keyword.types to Keyword.instance_types
- Rename Keyword.depends to Keyword.depends_on
- Move translation vocabulary implementation to its own repo (jschon-translation)
Miscellaneous:
- Allow any JSON-compatible value to be set as an error on a Result node
- Array/object applicator keywords -- additionalProperties, unevaluatedProperties, propertyNames, additionalItems, items, prefixItems, unevaluatedItems -- now produce an error array of failing child indices
- Register output formatters with a decorator
- Remove JSON type checks for unsupported usage
- Append (rather than replace) the suffix when resolving a LocalSource filepath
- Flatten dict of subresults on Result node
- Provide a useful __str__ method for Result node
Features:
- Added JSONPointer prefix test operators (#29)
Miscellaneous:
- Add PEP-561 py.typed marker to signal to type checkers that this library has usable type annotations.
Miscellaneous:
- Include translation vocabulary definition files in the distribution.
Miscellaneous:
- The requests dependency for remote $refs is now an optional install.
Features:
- Added support for remote schema references and, more generally, 'sources' for loading URI-identified JSON resources
- Added a JSON Patch implementation
- Added a Relative JSON Pointer implementation
- Added experimental support for a JSON translation vocabulary
Breaking changes:
- Replaced the Catalog.add_directory method with the more general Catalog.add_uri_source
Bug fixes:
- Fixed error messaging for the "required" keyword
- Eliminated extraneous error messages from "additionalProperties" and "items" by reverting to the Draft 7 approach for applying these keywords (#17)
Miscellaneous:
- Implemented a Catalog instance registry, replacing the default instance approach
- Moved JSON Schema vocabulary initialization from the Catalog class to the create_catalog function
- Replaced the AnyJSONCompatible type variable with a JSONCompatible type alias
- Removed isinstance type checks that would only fail if type hints were disregarded
- Removed printing of JSON instance values for "enum" and "const" error messages
- Decorated several JSON and JSONSchema properties with @cached_property
- Constrained the Keyword.types and Keyword.depends class attributes to allow tuples only
- Removed unused code supporting instantiation of JSON arrays/objects from collections of JSON class instances
- Changed type hints for JSON inequality operators to indicate that they are supported only for strings and numbers
- Removed unnecessary type coercion in JSON inequality operators
- Generalized Keyword class mixins to support custom subschema construction by custom applicator keywords
- Added a required positional arg instance to the Scope constructor
- Removed the path, instpath and relpath Scope constructor args
- Added a cls keyword arg to Scope.__call__ supporting custom Scope classes
- Generalized output formatting, to support custom output formats by extensions
- Added a globals property to the root of the Scope tree, for arbitrary evaluation state
- Added a Keyword.static class attribute, obviating the need to override can_evaluate
Documentation:
- Added example of extending JSON Schema with a custom keyword, vocab and meta-schema
- Various improvements to wording and structuring of docs
Miscellaneous:
- The default param of create_catalog() now defaults to True
- Allow "$id" and "$schema" to be omitted from meta-schema documents
- Renamed JSON.value to JSON.data; JSON.value now returns the instance data as a JSON-compatible Python object (#18)
- Switched to reStructuredText across the board - top-level
*.rst
files are now included in the docs and in the published package
Bug fixes:
- Fixed "absoluteKeywordLocation" output for "$ref", "$dynamicRef" and "$recursiveRef" nodes (#15)
Documentation:
- Restructured examples; example outputs are now verified by unit tests
- Added examples of loading schemas from files
Breaking changes:
- Renamed Catalogue to Catalog
Features:
- Top-level catalogue initialization function
- Session id-based schema caching
Breaking changes:
- Removed the Catalogue.create_default_catalogue method
Documentation:
- Added sections on getting started and running the tests
- Improved JSONSchema and Catalogue usage docs
Features:
- Detailed and verbose output format options
Breaking changes:
- JSONSchema.validate() now returns a Scope result object
Bug fixes:
- Fixed the instance location (shown in output) for object keys evaluated by "propertyNames"
Miscellaneous:
- Failing schema nodes no longer have error messages, and are excluded from basic output
- A Scope.passed property indicates a scope's assertion result, while Scope.valid indicates its validation result (these can only differ for an "if" keyword subscope)
- Improved the API (used by keywords) and internal structure of the Scope class
- Dropped the Annotation and Error classes
Features:
- An output method on Scope, providing output formatting
Breaking changes:
- Dropped the Evaluator class
Miscellaneous:
- Moved Metaschema, Vocabulary and Keyword into the vocabulary subpackage
Bug fixes:
- Fixed error and annotation collection for array items (#8)
Miscellaneous:
- Improved and better encapsulated the Scope class's internal logic
- Added
doc
dependencies to setup.py - Support testing with Python 3.10
Features:
- Evaluator class providing output formatting
- Multiple Catalogue instances now supported; with an optional default catalogue
Bug fixes:
- Fixed percent-encoding of the URI fragment form of JSON pointers
Documentation:
- Created user guides and API reference documentation; published to Read the Docs
Miscellaneous:
- Improvements to base URI-directory mapping and file loading in the Catalogue
- Tweaks to annotation and error collection in the Scope class affecting output generation
- Auto-generated schema URIs are now formatted as
'urn:uuid:<uuid>'
Features:
- Class methods for constructing JSON instances from JSON strings/files
Bug fixes:
- Fixed unevaluatedItems-contains interaction
Miscellaneous:
- Top-level package API defined in
__init.py__
- Improved handling of floats in JSON constructor input
- Removed mod operator from JSON class
- Added development setup (
pip install -e .[dev]
) - Added JSON class usage info to the README
Bug fixes:
- Fixed $dynamicRef resolution (#3)
Features:
- JSON class implementing the JSON data model
- JSON Pointer implementation
- JSON Schema implementation, supporting drafts 2019-09 and 2020-12 of the specification
- Catalogue for managing (meta)schemas, vocabularies and format validators
- URI class (wraps rfc3986.URIReference)