Skip to content

Add module to work with schemas#143

Merged
ssbarnea merged 2 commits intomainfrom
fix/schemas
May 23, 2022
Merged

Add module to work with schemas#143
ssbarnea merged 2 commits intomainfrom
fix/schemas

Conversation

@ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented May 21, 2022

Based on original implementation made by @cidrblock this will allow us to reuse schema tools across multiple project, especially as the lower level python-jsonschema project does not produce identical results between runs.

The main reason for having our own wrapped on top of python-jsonschema project is that this library does not produce consistent results. Apparently the maintainer does not consider the need to always sort reported errors as needed, thus both ways (validate() and iter_errors()) to retrieve them can produce variable results between subsequent runs even when all input data is identical.

In follow-ups we will likely add a schema store class, so we will ensure we do not instantiate schemas more often than needed.

Related:

@ssbarnea ssbarnea requested a review from webknjaz as a code owner May 21, 2022 08:44
@ssbarnea ssbarnea added the enhancement New feature or request label May 21, 2022
@ssbarnea ssbarnea requested review from cidrblock and removed request for webknjaz May 21, 2022 09:32
@ssbarnea ssbarnea requested a review from a team as a code owner May 21, 2022 09:33
Based on original implementation made by @cirdblock this will allow
us to reuse schema tools across multiple project, especially as the
lower level python-jsonschema project does not produce identical
results between runs.
Copy link
Collaborator

@cidrblock cidrblock left a comment

Choose a reason for hiding this comment

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

Clever sorting method..... only because I learned about it the other day, if we ever need the others: https://docs.python.org/3/library/functools.html#functools.total_ordering

@ssbarnea ssbarnea merged commit 9ed200b into main May 23, 2022
@ssbarnea ssbarnea deleted the fix/schemas branch May 23, 2022 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants