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

[fix] swagger importer: do not assume object param type has properties #1570

Merged

Conversation

@forresty
Copy link
Contributor

commented Jun 22, 2019

When playing with Docker Engine API:

https://docs.docker.com/engine/api/v1.39/

I found that it failed to import Swagger spec provided by Docker:

https://docs.docker.com/engine/api/v1.39/swagger.yaml

image

After some digging it seems when generating parameter example for object types, the swagger importer always assumes the existence of properties key, but it's not always the case, for example, from the Docker Engine API spec:

https://gist.github.com/forresty/374c79137e3ce997daead2e73ff92758#file-docker-swagger-insomnia-yaml-L811-L821

image

This ExposedPorts does not have a properties key, results in a "failed to import" error.

This tiny patch fixes this problem, now it handles all endpoint definitions of the Docker Engine API yaml file and has nice examples:

image

Note that some small changes need to be applied when importing the Docker spec, namely need to remove https from schemes and add the host key:

https://gist.github.com/forresty/374c79137e3ce997daead2e73ff92758/revisions

image

Thanks for this wonderful piece of software by the way ;-)

@welcome

This comment has been minimized.

Copy link

commented Jun 22, 2019

💖 Thanks for opening this pull request! 💖

To help make this a smooth process, please be sure you have first read the
contributing guidelines.

@gschier
Copy link
Collaborator

left a comment

Awesome, thanks for making this change @forresty! 🙌🌟

@gschier gschier merged commit a4f56ff into getinsomnia:develop Jun 24, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@welcome

This comment has been minimized.

Copy link

commented Jun 24, 2019

Congrats on merging your first pull request! 🎉🎉🎉 You're helping make Insomnia awesome! 🙌

@forresty forresty deleted the forresty:bugfix/swagger-importer-docker branch Jun 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.