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

Remote file reference URIs are broken on Windows #145

Closed
N3X15 opened this issue Dec 16, 2017 · 2 comments
Closed

Remote file reference URIs are broken on Windows #145

N3X15 opened this issue Dec 16, 2017 · 2 comments
Milestone

Comments

@N3X15
Copy link
Contributor

N3X15 commented Dec 16, 2017

I'm working on an archive tool for a client, who wanted an 8chan archiver. I decided to use swagger to document and use their API, and pyswagger in particular, since my archiver is written in python and is older than God. It also, unfortunately, currently runs on Windows.

With the background out of the way: pyswagger has many issues on Windows with Python 3.6.

Summary

$refs pointing to a relative URI receive the wrong path seperator on Windows machines when accessing a remotely hosted YML or JSON file.

My JSONified schema (YAML triggers other bugs): https://gitlab.com/N3X15/8chan-API/blob/0fdd6548a94ff869c4588f2f36ccc6e79b58a74d/8chan.swagger.json
Log: https://hastebin.com/topoxitepe.txt

Reproduction Steps

  1. Make a schema with relatively-referenced fragments, like "$ref": "definitions/Hurf.json"
  2. Ensure the referenced files exist and are valid.
  3. Upload everything to a server somewhere.
  4. Run App.create() on the URI
  5. Duck.

Expected response

App.create() succeeds.

Observed response

App.create implodes with 404 errors, and the log shows that the base URI of the schema is joined with a backslash rather than the correct forwardslash.

e.g. Instead of https://example.com/api/definitions/Thing.json, we get https://example.com/api\definitions/Thing.json

Environment

(.virtualenv) Rob@RAGE F:\Projects\ChanManBot
> python --version
Python 3.6.3

(.virtualenv) Rob@RAGE F:\Projects\ChanManBot
> pip freeze
attrs==17.3.0
Automat==0.6.0
beautifulsoup4==4.6.0
certifi==2017.11.5
chardet==3.0.4
colorama==0.3.9
constantly==15.1.0
hyperlink==17.3.1
idna==2.6
incremental==17.5.0
Jinja2==2.10
lxml==3.7.2
MarkupSafe==1.0
mysqlclient==1.3.9
olefile==0.44
Pillow==4.3.0
psutil==5.4.2
pyaml==17.10.0
pybuildtools==0.2.1
pyparsing==2.2.0
pyswagger==0.8.36
python-json-logger==0.1.8
pywin32==220.1
PyYAML==3.12
pyzmq==16.0.3
requests==2.18.4
six==1.11.0
SQLAlchemy==1.1.15
toml==0.9.3
tqdm==4.19.5
Twisted==17.9.0
urllib3==1.22
validate-email==1.3
zope.interface==4.4.3
@mission-liao
Copy link
Member

@N3X15 I think the problem is here and would look into this problem later.

I would also investigate using AppVeyor to make sure pyswagger works on Windows platform (since I don't have one at hand)

@N3X15
Copy link
Contributor Author

N3X15 commented Dec 17, 2017

OK, I should have a PR up shortly that fixes it and a few other minor niggles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants