W 18764378/oasdiff on multi vers of api#233
Conversation
vcua-mobify
left a comment
There was a problem hiding this comment.
I've verified that these changes work in the node sdk to address the duplicate endpoints errors that appear as a result of having -internal and -public yaml files in the same location.
I just have a small comment about maybe separating the logic for directory mode but otherwise LGTM.
src/diff/oasDiff.ts
Outdated
| baseApiTarget = '"' + baseApi + "/**/*.yaml" + '"'; | ||
| newApiTarget = '"' + newApi + "/**/*.yaml" + '"'; | ||
| } | ||
| // Find all exchange.json files and their parent directories |
There was a problem hiding this comment.
Nit: There's a lot of logic specifically for handling directory mode. I wonder if we should break it off into a separate function just to make things a bit easier to read?
There was a problem hiding this comment.
good call. I've break it down a bit. Please take another look when you get some time
vcua-mobify
left a comment
There was a problem hiding this comment.
Thanks for adjusting @alexvuong !
| ); | ||
| } | ||
| } | ||
| } else { |
There was a problem hiding this comment.
nit: Is this case even possible.. where the directory exists but Yaml is missing? May be when download has some issues
There was a problem hiding this comment.
Good point. I think it is stil good to leave it here if download happens to has some issue and dev does not realize it and run oasdiff. The logic in here simply notify which yml files are removed from previous version into output file
This PR fixed the oasdiff command to be compatible with multiple version of the same API. (E.g shopper-basket v2 and v1)
Problem:
Since we are pulling multiple verserions of the same apis. Some of them will have the same endpoints. When we try to run
oasdiff changlogon the parent directory (apis vs oldApis). We ran into an error of endpoint duplication.Solution
Loop through the each API folder and run oasdiff instead of the parent directory. This will guarantee there is not duplication in each run and concat the results into a txt file.
How to test drive
How to test the changes on isomorphic
yarn cinpm run updateApistwice to get the current api copied to oldApis folderyarn run diffApisand observe the diffApis. You should see output look similiar to this.default format output