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

swagger.io doesn't like latest or legacy json #494

Closed
rlc4 opened this issue Jul 19, 2017 · 6 comments
Closed

swagger.io doesn't like latest or legacy json #494

rlc4 opened this issue Jul 19, 2017 · 6 comments

Comments

@rlc4
Copy link

rlc4 commented Jul 19, 2017

Bug

API file for 'Character' cannot be generated

Cannot follow the steps provided here: https://developers.eveonline.com/blog/article/swagger-codegen

Existing API definition results in a message from swagger.io:
https://developers.eveonline.com/blog/article/swagger-codegen

Via the web page or via curl, the results are the same. The newer swagger.io editor doesn't display an error message when a client is being generated, however the "previous editor version" does, and it matches the one shown in curl:

Request

curl -X POST -H "Content-Type: application/json" -d '{"swaggerUrl":"https://esi.tech.ccp.is/legacy/swagger.json?datasource=tranquility"}' "http://generator.swagger.io/api/gen/clients/python"

Response

{"code":1,"type":"error","message":"Unable to build target: Could not generate api file for 'Character'"}

Expected

A link for a downloadable zip file that would contain a client API.

@aquarhead aquarhead added the New label Jul 19, 2017
@ccp-zoetrope
Copy link
Contributor

Thanks for the heads up. Looks like there are some internal server errors populating the JSON delivered by https://esi.tech.ccp.is/legacy/swagger.json that are probably throwing the generator off.

@ccp-zoetrope
Copy link
Contributor

I was actually wrong, looks like this has to do with the Swagger generator itself, as some of the clients still generate correctly with the ESI spec (such as elixir). I'm still looking into what is the problem though.

@aquarhead
Copy link
Contributor

If you run the swagger-codegen locally it works fine: (example from here)

◊ docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate -i "https://esi.tech.ccp.is/_latest/swagger.json?datasource=tranquility" -l python -o /local/out/py
Unable to find image 'swaggerapi/swagger-codegen-cli:latest' locally
latest: Pulling from swaggerapi/swagger-codegen-cli
709515475419: Pull complete
38a1c0aaa6fd: Pull complete
cd134db5e982: Pull complete
dd470d685667: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:16978b9bc88a501e3aa7dc56bfa6522b6745886483b620e4dab70d3d751ea632
Status: Downloaded newer image for swaggerapi/swagger-codegen-cli:latest
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://esi.tech.ccp.is/_latest/swagger.json?datasource=tranquility
[main] WARN io.swagger.codegen.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.swager-codegen-ignore) will be evaluated.
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/delete_characters_character_id_mail_labels_label_id_unprocessable_entity.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_delete_characters_character_id_mail_labels_label_id_unprocessable_entity.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/DeleteCharactersCharacterIdMailLabelsLabelIdUnprocessableEntity.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/delete_fleets_fleet_id_members_member_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_delete_fleets_fleet_id_members_member_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/DeleteFleetsFleetIdMembersMemberIdNotFound.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/delete_fleets_fleet_id_squads_squad_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_delete_fleets_fleet_id_squads_squad_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/DeleteFleetsFleetIdSquadsSquadIdNotFound.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/delete_fleets_fleet_id_wings_wing_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_delete_fleets_fleet_id_wings_wing_id_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/DeleteFleetsFleetIdWingsWingIdNotFound.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/forbidden.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_forbidden.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/Forbidden.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/get_alliances_alliance_id_icons_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/test/test_get_alliances_alliance_id_icons_not_found.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/docs/GetAlliancesAllianceIdIconsNotFound.md
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /local/out/py/swagger_client/models/get_alliances_alliance_id_icons_ok.py
... (a lot more writing file)

This smells like something wrong with their(Swagger's) editor interface.

@ccp-zoetrope
Copy link
Contributor

It looks like https://generator.swagger.io is using Swagger codegen v2.2.3 which has a bug in it. @rlc4, until they update their generator to use v2.3.0 then I would recommend using the docker command suggested by @aquarhead. Until then I am watching a few related issues on swagger-codegen, namely swagger-api/swagger-codegen#6098 and swagger-api/swagger-codegen#6119 and will update this issue once it looks like their online tools are working again.

@aquarhead aquarhead added Done and removed New labels Jul 20, 2017
@rlc4
Copy link
Author

rlc4 commented Jul 20, 2017

Thanks for the assistance, this does provide a method to get a swagger client set up to develop with.

As a suggestion, perhaps the documentation I referenced ( https://developers.eveonline.com/blog/article/swagger-codegen ) should be updated to include the Docker method as well as the existing swagger.io and curl methods.

@ccp-zoetrope
Copy link
Contributor

@rlc4 I totally agree with you, which is why we released this new blog talking about using the docker method. The original blog was also updated with references to the new one.

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

3 participants