oasis-open / cti-stix-validator

OASIS TC Open Repository: Validator for STIX 2.0 JSON normative requirements and best practices
https://stix2-validator.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
50 stars 41 forks source link

draft7_format_checker is deprecated #200

Closed subbyte closed 1 year ago

subbyte commented 2 years ago

I get a warning about a library update:

  /usr/lib64/python3.10/site-packages/stix2validator/validator.py:11: DeprecationWarning: Accessing jsonschema.draft7_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator.
    from jsonschema import Draft7Validator, RefResolver, draft7_format_checker

The function may need an update to avoid breaking down in future release.

clenk commented 2 years ago

This would be fixed by https://github.com/oasis-open/cti-stix-validator/pull/191, which switches to a more recent draft of JSON Schema.

captainGeech42 commented 1 year ago

Now that #191 is merged, would it be possible to publish a new release to pypi?

ejratl commented 1 year ago

@captainGeech42 Yes, give me a few days and I will do that.

ejratl commented 1 year ago

@captainGeech42 The new release is on pypi. I'd love it if you would test it to see if it fixes your problem.

captainGeech42 commented 1 year ago

@ejratl I still see 3.0.2 as the latest on pypi, is there a different package I should be looking at?

image

rpiazza commented 1 year ago

Hi @captainGeech42,

Sorry - 3.1.0 was withdrawn, but there should be a new (better) release soon.

ejratl commented 1 year ago

@captainGeech42 3.1.2 is up now, please give it a whirl: https://pypi.org/project/stix2-validator/3.1.2/

captainGeech42 commented 1 year ago

On 3.1.2, I'm getting an exception for the newer format now being deprecated.

$ pip freeze | grep stix2-validator
stix2-validator==3.1.2

$ pip freeze | grep jsonschema
fastjsonschema==2.15.3
jsonschema==4.16.0

$ python script.py 2>&1 | grep stix2      
../../venv/py3/lib/python3.10/site-packages/stix2validator/validator.py:11
../../venv/py3/lib/python3.10/site-packages/stix2validator/validator.py:11
  /home/geech/venv/py3/lib/python3.10/site-packages/stix2validator/validator.py:11: DeprecationWarning: Accessing jsonschema.draft202012_format_checker is deprecated and will be removed in a future release. Instead, use the FORMAT_CHECKER attribute on the corresponding Validator.
captainGeech42 commented 1 year ago

@ejratl would it be possible to cut a new release to PyPI with this bug fix in it?

ejratl commented 1 year ago

@captainGeech42 Since you are asking for it, yes, I can do that.

captainGeech42 commented 1 year ago

awesome, thank you very much!

ejratl commented 1 year ago

@captainGeech42 please try 3.1.3 and let me know if it works for you

captainGeech42 commented 1 year ago

looks good now, thank you @ejratl !