-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Different order of parameters in HTML Report #190
Comments
Hi, Thanks very much for your kind feedback. Before fixing ordering, I wanted to understand why it's important to you. The HTML report's purpose is to render the results in a valuable, quick, and easy way to view. However, it sounds like you're performing some diff checks on the files to see what's changed. Because there shouldn't be any impact on the report if things are re-ordered, it will mess things up if you're trying to use the report to determine if something has changed. If you're trying to determine what has changed between two specs - there is a much more powerful way to do so (rather than using vacuum). libopenapi has a feature called A brand new tool (prototype only for right now) turns this library into a complete application (like vacuum). It allows changes to be seen across the entire history of a specification (if it's stored in Git). You can see that here: https://github.com/pb33f/openapi-changes (warning, prototype only for now). Of course, that all being said, if you're not looking to determine what has changed, then I need to know a little more about the ordering requirements for the report. |
Thanks for the quick reply. Well I think it is little bit of both. Maybe this quick drawing helps:
The Readme as well as all the vacuum html reports are hosted via Github-Pages for easy viewing. See Readme-Webpage or example for one report here. Does this make more sense? tl;dr: For me changes of the OpenAPI are import if they change the vacuum html report which is hosted via GitHub Pages for al of our OpenAPIs. For this the order of parameter should be consistent (to prevent "fake" changes of the html). |
An interesting use-case popped up where vacuum is being used as a 'diff check' tool to determine if output has changed. Some of the data was being rendered randomly, due to it not being sorted consistently. This change has been made to ensure that reach run will be identical in order and HTML will always result in identical output. Also to ensure this is possible (and will validate against a sha256 hash), there is a new `-d` flag available for the `html-report` command. This has been added to the docs at: https://quobix.com/vacuum/commands/html-report/ Signed-off-by: Dave Shanley <dave@quobix.com>
An interesting use-case popped up where vacuum is being used as a 'diff check' tool to determine if output has changed. Some of the data was being rendered randomly, due to it not being sorted consistently. This change has been made to ensure that reach run will be identical in order and HTML will always result in identical output. Also to ensure this is possible (and will validate against a sha256 hash), there is a new `-d` flag available for the `html-report` command. This has been added to the docs at: https://quobix.com/vacuum/commands/html-report/ Signed-off-by: Dave Shanley <dave@quobix.com>
A very interesting use case! From version You can also use the new The docs have been updated here: https://quobix.com/vacuum/commands/html-report/ Thank you for your help making vacuum a better tool! |
used flag to disable timestamp, Thanks to @daveshanley, see daveshanley/vacuum#190
Awesome! Thanks! |
Glad to see you're using the API! It's a breaking change there, and I wasn't aware anyone was using it - apologies! |
The flag to disable the timestamp works fine. 🚀
like this now. The last bool It looks like there are still difference for different runtimes (See this PR). I will check locally again and see if this is continuous problem. Again Thanks for this awesome tool! |
Hmm, interesting, I was running the stripe API, and it was coming out identical each time. Could you link to a couple of the specs you're finding inconsistent and I can try those on a few different runtimes? |
Yes:
Also It looks like a few of the difference of the html outputs comes from different order of the |
I think I know what the issue is, I will put a fix together in the next 24 hours or so. |
Examples being the culprit, in large specs with lots of examples, some ordering was failing because there was not enough detail in the sort (it was only checking a couple of properties). Now sorting checks all the way down the model and applies a hash to paths and messages to ensure consistent ordering. Testing against stripe, k8s, petstore and user supplied specs that were causing issues. Signed-off-by: Dave Shanley <dave@quobix.com>
Examples being the culprit, in large specs with lots of examples, some ordering was failing because there was not enough detail in the sort (it was only checking a couple of properties). Now sorting checks all the way down the model and applies a hash to paths and messages to ensure consistent ordering. Testing against stripe, k8s, petstore and user supplied specs that were causing issues. Signed-off-by: Dave Shanley <dave@quobix.com>
OK, so you should be good to go. The problem was the sorting algorithm wasn't very robust. I was only sorting by line number. Please try version |
Thanks! Looks like it is working much better now. Sadly I am still getting changes for one API (pegel-online-api). I am not sure what is different with this API. See this PR Quick check with the pegel-online openapi and this bash script:
Gives the following result:
This number various with different runs. I will look further into the changes It looks like most changes start in line 1795. |
I do love a game of whack-a-mole! Looks like it's more of the same issue, just further down. I will investigate and have a patch available in the next 24 hours. |
Awesome, to test it 200 times was just a fun run ;) |
This is a little strange to be honest, I am getting completely different results with that same spec, along with running your bash script. Just to ensure I am not going crazy, I added the spec you mentioned to the sample specs in the repo, and created two new tests, a standard benchmark and a deliberate re-creation of the bash script in code as part of the test suite Tests don't fail, and the bash-script passes fine for me, and it seems run in the pipeline too without issue. I am unable to re-create this problem! To see the new tests: https://github.com/daveshanley/vacuum/blob/main/benchmarks/html_report_test.go#L42 |
ok, thanks for testing. I will do more testing and see where my error is. |
It looks like the API your are testing is not the pegel-online-api specification (it is the openapi from DWD - this API works fine for me as well with the bash script) The openapi for the pegel-online-api (https://github.com/bundesAPI/pegel-online-api/blob/main/openapi.yaml) starts like this:
I just created a PR to update the openapi to the correct one see #198. Sorry for the confusion, to many apis and versions flying around.. |
After digging deeper, I've discovered a few more issues that I'll need to fix to make this right. |
FYI: #199 There were some lower-level issues I needed to resolve before this could be fixed properly. Can you try |
It is working! Went for a fun run with 1000 tries for the bash script: Also everything working now for the initial problem (https://github.com/t-huyeng/check-bundesAPI-repos/actions/runs/3648578748/jobs/6162163700) Thanks again for the awesome project 🚀 and quick help ❤️ ! |
First of all great project!
I use vacuum to generate html reports for all the openapis we have created within the bunddev project,
For this I created a Go-script which runs every night and creates a PR if changes of the HTML-reports exist. I already removed the line where the generated time has been set with a small hack. But it looks like the order of parameters is different on some runs.
See this PR (which was created through the github action):
t-huyeng/check-bundesAPI-repos#8
It shows the changes of the html files: as far as I see it the changes are because of a changed order of parameters or other information.
Can you confirm that the order is not always the same? Could you thing about implementing something which keeps the order the same for every run?
Thanks
The text was updated successfully, but these errors were encountered: