NetBox API swagger docs fetch url error #5443

Closed
opened 2025-12-29 19:28:04 +01:00 by adam · 10 comments
Owner

Originally created by @cybarox on GitHub (Sep 30, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.4

Python version

3.8

Steps to Reproduce

  1. open https://demo.netbox.dev/api/docs/
  2. View Fetch Error

Expected Behavior

API docs opens

Observed Behavior

API docs show Fetch URL error

Originally created by @cybarox on GitHub (Sep 30, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.4 ### Python version 3.8 ### Steps to Reproduce 1. open https://demo.netbox.dev/api/docs/ 2. View Fetch Error ### Expected Behavior API docs opens ### Observed Behavior API docs show Fetch URL error
adam added the type: bugstatus: accepted labels 2025-12-29 19:28:04 +01:00
adam closed this issue 2025-12-29 19:28:04 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2021):

Looks like a bug in an upstream dependency. This is actively being worked on by the respective teams, so we'll hold off a bit to see how they decide to handle it.

In the meantime, you can work around this bug by directly installing jsonschema 3.2.0 within the NetBox virtual environment and restarting the NetBox service:

cd /opt/netbox/
source venv/bin/activate
pip install jsonschema==3.2.0
sudo systemctl restart netbox netbox-rq

Edit: I've fixed the demo instance.

@jeremystretch commented on GitHub (Sep 30, 2021): Looks like a [bug in an upstream dependency](https://github.com/Yelp/swagger_spec_validator/issues/149). This is actively being worked on by the respective teams, so we'll hold off a bit to see how they decide to handle it. In the meantime, you can work around this bug by directly installing `jsonschema` 3.2.0 within the NetBox virtual environment and restarting the NetBox service: ``` cd /opt/netbox/ source venv/bin/activate pip install jsonschema==3.2.0 sudo systemctl restart netbox netbox-rq ``` Edit: I've fixed the demo instance.
Author
Owner

@tirkarthi commented on GitHub (Sep 30, 2021):

https://github.com/Julian/jsonschema/issues/845#issuecomment-931282776

4.0.0 has now been yanked and 4.0.1 was released with a fix for python_requires

@tirkarthi commented on GitHub (Sep 30, 2021): https://github.com/Julian/jsonschema/issues/845#issuecomment-931282776 4.0.0 has now been yanked and 4.0.1 was released with a fix for `python_requires`
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2021):

Well that was fast! Thanks for the heads up, @tirkarthi! Appreciate the quick fix!

@jeremystretch commented on GitHub (Sep 30, 2021): Well that was fast! Thanks for the heads up, @tirkarthi! Appreciate the quick fix!
Author
Owner

@cybarox commented on GitHub (Sep 30, 2021):

with jsonschema==4.0.1 still the same issue, temp fix works for me

@cybarox commented on GitHub (Sep 30, 2021): with jsonschema==4.0.1 still the same issue, temp fix works for me
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2021):

Agreed, still seems to be an issue.

@jeremystretch commented on GitHub (Sep 30, 2021): Agreed, still seems to be an issue.
Author
Owner

@tirkarthi commented on GitHub (Sep 30, 2021):

Is there a traceback showing the error in jsonschema?

@tirkarthi commented on GitHub (Sep 30, 2021): Is there a traceback showing the error in jsonschema?
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2021):

@tirkarthi here's what I've narrowed it down to:

$ python3.7 -m venv testing
$ source testing/bin/activate
(testing) $ pip install swagger_spec_validator
Collecting swagger_spec_validator
  Using cached swagger_spec_validator-2.7.3-py2.py3-none-any.whl (27 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting pyyaml
  Using cached PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (636 kB)
Collecting jsonschema
  Using cached jsonschema-4.0.1-py3-none-any.whl (69 kB)
Collecting attrs>=17.4.0
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
  Using cached pyrsistent-0.18.0-cp37-cp37m-manylinux1_x86_64.whl (119 kB)
Collecting importlib-metadata; python_version < "3.8"
  Using cached importlib_metadata-4.8.1-py3-none-any.whl (17 kB)
Collecting typing-extensions>=3.6.4; python_version < "3.8"
  Using cached typing_extensions-3.10.0.2-py3-none-any.whl (26 kB)
Collecting zipp>=0.5
  Using cached zipp-3.6.0-py3-none-any.whl (5.3 kB)
Installing collected packages: six, pyyaml, attrs, pyrsistent, typing-extensions, zipp, importlib-metadata, jsonschema, swagger-spec-validator
Successfully installed attrs-21.2.0 importlib-metadata-4.8.1 jsonschema-4.0.1 pyrsistent-0.18.0 pyyaml-5.4.1 six-1.16.0 swagger-spec-validator-2.7.3 typing-extensions-3.10.0.2 zipp-3.6.0
WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available.
You should consider upgrading via the '/home/jstretch/testing/bin/python3.7 -m pip install --upgrade pip' command.

$ python
Python 3.7.10 (default, Feb 20 2021, 21:17:23) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from swagger_spec_validator import ref_validators
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/__init__.py", line 8, in <module>
    from swagger_spec_validator.util import validate_spec_url
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/util.py", line 9, in <module>
    from swagger_spec_validator import validator12
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/validator12.py", line 29, in <module>
    from swagger_spec_validator.ref_validators import default_handlers
  File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/ref_validators.py", line 14, in <module>
    from jsonschema.compat import iteritems
ModuleNotFoundError: No module named 'jsonschema.compat'
>>> 
@jeremystretch commented on GitHub (Sep 30, 2021): @tirkarthi here's what I've narrowed it down to: ``` $ python3.7 -m venv testing $ source testing/bin/activate (testing) $ pip install swagger_spec_validator Collecting swagger_spec_validator Using cached swagger_spec_validator-2.7.3-py2.py3-none-any.whl (27 kB) Collecting six Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting pyyaml Using cached PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (636 kB) Collecting jsonschema Using cached jsonschema-4.0.1-py3-none-any.whl (69 kB) Collecting attrs>=17.4.0 Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB) Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 Using cached pyrsistent-0.18.0-cp37-cp37m-manylinux1_x86_64.whl (119 kB) Collecting importlib-metadata; python_version < "3.8" Using cached importlib_metadata-4.8.1-py3-none-any.whl (17 kB) Collecting typing-extensions>=3.6.4; python_version < "3.8" Using cached typing_extensions-3.10.0.2-py3-none-any.whl (26 kB) Collecting zipp>=0.5 Using cached zipp-3.6.0-py3-none-any.whl (5.3 kB) Installing collected packages: six, pyyaml, attrs, pyrsistent, typing-extensions, zipp, importlib-metadata, jsonschema, swagger-spec-validator Successfully installed attrs-21.2.0 importlib-metadata-4.8.1 jsonschema-4.0.1 pyrsistent-0.18.0 pyyaml-5.4.1 six-1.16.0 swagger-spec-validator-2.7.3 typing-extensions-3.10.0.2 zipp-3.6.0 WARNING: You are using pip version 20.1.1; however, version 21.2.4 is available. You should consider upgrading via the '/home/jstretch/testing/bin/python3.7 -m pip install --upgrade pip' command. $ python Python 3.7.10 (default, Feb 20 2021, 21:17:23) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from swagger_spec_validator import ref_validators Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/__init__.py", line 8, in <module> from swagger_spec_validator.util import validate_spec_url File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/util.py", line 9, in <module> from swagger_spec_validator import validator12 File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/validator12.py", line 29, in <module> from swagger_spec_validator.ref_validators import default_handlers File "/home/jstretch/testing/lib/python3.7/site-packages/swagger_spec_validator/ref_validators.py", line 14, in <module> from jsonschema.compat import iteritems ModuleNotFoundError: No module named 'jsonschema.compat' >>> ```
Author
Owner

@tirkarthi commented on GitHub (Sep 30, 2021):

Ok, it seems swagger project still needs to pin down the version.

@tirkarthi commented on GitHub (Sep 30, 2021): Ok, it seems swagger project still needs to pin down the version.
Author
Owner

@tirkarthi commented on GitHub (Sep 30, 2021):

https://github.com/Yelp/swagger_spec_validator/pull/146 seems to fix this.

@tirkarthi commented on GitHub (Sep 30, 2021): https://github.com/Yelp/swagger_spec_validator/pull/146 seems to fix this.
Author
Owner

@jeremystretch commented on GitHub (Sep 30, 2021):

I should have this fixed for us by pinning jsonschema==3.2.0 for now. We should revisit this once swagger_spec_validator has been updated.

@jeremystretch commented on GitHub (Sep 30, 2021): I should have this fixed for us by pinning `jsonschema==3.2.0` for now. We should revisit this once `swagger_spec_validator` has been updated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5443