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

vscode-swagger-diff ability to integrate with CI tool Jenkins or output in command line #1

Open
leowestx opened this issue Apr 15, 2022 · 7 comments

Comments

@leowestx
Copy link

Hi there,

I was looking at this plugin and it is fantastic but I am just wondering if there is a way I can integrate this as part of the CI tool Jenkins in order to automate this process of creating release notes. Something like once a build is done, it will automate the process of comparing files and making release notes? Even if there is an option to generate the output into VS code CLI at least it would be great. Kindly let me know if any ideas to do this. Thank you

@psrabhishek
Copy link
Owner

Hi @leowestx ,

I am glad to hear you liked the tool and found it useful.

I understand what you mean by adding it to a CI tool to automate build notes. I am internally using a node package in the VSCode plug-in which is written in TypeScript.

You might not necessarily need to use the same plugin, instead you can come use a python, java or even a bash script to use such a library to get the swagger-diff and parse/process it the way you desire.

For example, I have written one python script for the organization I work, to get the diff for any selected Module (swagger file) between any two release versions, using the open-source library: https://github.com/Sayi/swagger-diff with HTML as output.

Similarly you can use any swagger-diff library which will give you more flexibility for your use case.

I am happy to help you if you can elaborate a bit more on your requirement. (like how do you want to pass the file path in input, how to determine which version of file you want to compare it with, what format of output you would want, etc)

@leowestx
Copy link
Author

leowestx commented Apr 16, 2022 via email

@psrabhishek
Copy link
Owner

Hello,

What I meant by

“ You might not necessarily need to use the same plugin, instead you can come use a python, java or even a bash script to use such a library to get the swagger-diff and parse/process it the way you desire.”

Is that your are not just limited to my VS Code Plugin, you can use any other available libraries and use any custom script to do custom processing and get desired output.

Since you prefer the output coming from my plugin, you can use https://github.com/zallek/swagger-diff#cli to get the same results, but in a non-html format. And you would also need to figure out a way to give the old and new files as input, which can be generated using git commands.

If you want the output to be html format only like generated by my plugin, I will try to come up with a node module to get a similar HTML output, which can be used in similar fashion as mentioned in https://github.com/zallek/swagger-diff#cli but can yield a HTML file as output.

Hope that works out for you to integrate into your build gradle.

@leowestx
Copy link
Author

leowestx commented Apr 16, 2022 via email

@psrabhishek
Copy link
Owner

Hello,

Before I can answer #1, I want to ask about your #2.

There are different approaches for developing webservice and the specification provided to consumers.

  1. Top-Down : first we define the specs(swagger, openAPI, XML schema, etc), it could be hand-typed, where the developer/product owner will define the spec and development is done abiding to the spec defined. we can check-in or commit these specs in our git repo if needed.

  2. Bottom-UP: We develop our webservices first, and generate the spec (swagger, openAPI, XML schema, etc) from our developed code. In this case the spec might not be checked-in into git repo and could be generated at build time.

No matter the approach we need to have the spec file to with the consumers of our webservices.

So, to answer your #2, you should be the one knowing about the swagger.json being checked-in or generated in case of your product/application.

I will answer you other question once you get clarity on this. Since we need 2 inputs, both old file and new file to get the diff and the process might differ to get these, based on how is the swagger spec handled in your case.

@leowestx
Copy link
Author

leowestx commented Apr 19, 2022 via email

@psrabhishek
Copy link
Owner

Hello,

Can you confirm if the swagger is committed into git repo.

If it is not committed into git repo, first you need to figure out how to get the Old Swagger Spec file as well, since the diff would be between Old spec and New spec.

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