swagger.json parse errors in bravado and pyswagger

Completed

I'm trying to use the swagger definitions to code a rest client in Python against a TeamCity server.   I've tried both bravado:

 

    from bravado.client import SwaggerClient
    client = SwaggerClient.from_url("https://teamcity/app/rest/swagger.json")

Traceback (most recent call last):
File "C:\Users\rrosenfeld\.virtualenvs\goodies-17AkiKLK\lib\site-packages\swagger_spec_validator\common.py", line 30, in wrapper
return method(*args, **kwargs)
File "C:\Users\rrosenfeld\.virtualenvs\goodies-17AkiKLK\lib\site-packages\swagger_spec_validator\validator20.py", line 210, in validate_json
ref_validators.validate(
File "C:\Users\rrosenfeld\.virtualenvs\goodies-17AkiKLK\lib\site-packages\swagger_spec_validator\ref_validators.py", line 52, in validate
instance_cls(schema, *args, **kwargs).validate(instance)
File "C:\Users\rrosenfeld\.virtualenvs\goodies-17AkiKLK\lib\site-packages\jsonschema\validators.py", line 353, in validate
raise error
jsonschema.exceptions.ValidationErrortype\': \'object\',\n \'xml\': {\'name\': \'buildChanges\'}},\n \'buildTriggeringOptions\': {\'properties\': {\'cleanSources\': {\'default\': False,\n

I've also tried pyswagger, which goes into an infinite loop processing the "#/definitions/FOO", entries like "#/definitions/build"

Any suggestions for someone new to tooling around w/ Swagger/OpenAPI?

 

2 comments
Comment actions Permalink

Hello Robert!

Thank you for reaching out on this matter. We do have a feature request regarding full Swagger support: https://youtrack.jetbrains.com/issue/TW-44962 which is on a High Priority pool, but as of now I was able to confirm that our swagger.json data does not match, at least, swagger.io specification.

Speaking of a workaround for Python client, I could create a test client via following:
1) on editor.swagger.io, upload the swagger.json from your TC version;
2) run Edit -> Convert to OpenAPI;
3) it will still show some validation errors, but anyway, you may now use Generate Client option above to download a Python set of classes and endpoint functions (as per my quick check, the code should be running fine).

I`ve reached out internally to further discuss specification mismatch and will circle back if I have something noteworthy. Otherwise, you may keep track of the above link to see the current status on this feature.

0
Comment actions Permalink

Thanks Fedor Rumyantsev.  I tried those steps and the TeamCity API never replaces the pet store demo.  The downloaded client is not for TeamCity, but the pet store.  I appreciate the information, but have moved on for now. 

0

Please sign in to leave a comment.