Skip to content
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

Changes necessary to support jsonschema 3.x #3705

Merged
merged 3 commits into from
Jun 24, 2019

Conversation

eslavich
Copy link
Collaborator

It's been pointed out that jsonschema 2.6 is incompatible with Python 3.8, so at some point we'll need to upgrade. These changes make jwst compatible with both jsonschema 2.6 and 3.0.

@@ -293,7 +293,7 @@ def _fits_item_recurse(validator, items, instance, schema):
def _fits_type(validator, items, instance, schema):
if instance in ('N/A', '#TODO', '', None):
return
return validators._validators.type_draft4(validator, items, instance, schema)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This method disappears in jsonschema 3.0, but luckily there is a way to access it through a public API that does not change between the versions.

@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This causes jsonschema to use the latest draft, whatever that is, which is a deprecated behavior in jsonschema 3.0. Also, the latest draft is now draft-07, whereas in jsonschema 2.6 it was draft-04 anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

hbushouse
hbushouse previously approved these changes Jun 20, 2019
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
"$schema": "http://json-schema.org/draft-04/schema",
Copy link
Collaborator

Choose a reason for hiding this comment

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

So we'll have to manually update this whenever we want to start using a new draft?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes that's correct. Incidentally, later versions aren't backwards compatible with draft-04, so we'll need to audit these files anyway.

nden
nden previously approved these changes Jun 20, 2019
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/schema#",
Copy link
Collaborator

Choose a reason for hiding this comment

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

@nden
Copy link
Collaborator

nden commented Jun 20, 2019

don't forget the change log

jdavies-st
jdavies-st previously approved these changes Jun 21, 2019
@nden nden added this to the 0.14.0 milestone Jun 24, 2019
@eslavich eslavich dismissed stale reviews from jdavies-st, nden, and hbushouse via b4a9633 June 24, 2019 14:58
@eslavich eslavich force-pushed the JP-809-support-jsonschema-3.x branch from 70302be to b4a9633 Compare June 24, 2019 14:58
@nden
Copy link
Collaborator

nden commented Jun 24, 2019

@eslavich Could you fix the conflict?

Copy link
Collaborator

@jdavies-st jdavies-st left a comment

Choose a reason for hiding this comment

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

This looks good.

And it is good that the jsonschema<=2.6 was not changed in setup.py. I think we can change that in a separate PR after a new release of asdf supporting jsonschema>=3.0 is released. That way we can avoid order-of-install issues with pip.

@nden nden merged commit b9027f7 into spacetelescope:master Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants