Skip to content

Remote file reference URIs are broken on Windows #145

@N3X15

Description

@N3X15

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions