-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[go-server] Moved helper code from router and updated logger for chi #20823
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
[go-server] Moved helper code from router and updated logger for chi #20823
Conversation
Please let me know if it would be better to split this into two MRs. One for the router helper move and one for the logger update. I thought doing both since they're related might be ok |
9d321e6
to
ba4c1d7
Compare
I think you can remove middleware import from router |
Yep I can! Sorry about that. Let me do another pass and see if I find anything else goofy I may have left |
Fixed the imports for chi and mux and reran the servers to make sure logs were still being spat out correctly. Missed the problem the first time due to my autoformatter kicking in and fixing imports for me |
@wing328 could you help to run the workflows So far lgtm |
@lwj5 thanks for reviewing the change @jarangutan thanks for the PR |
@jarangutan please review the CI failure when you've time |
@wing328 checked it. The |
To make sure, the samples_tests in that go-api-server folder wasn't auto generated right? I was checking to see if it was being made by something but couldn't find it |
yes, those manually written tests need to be updated manually as part of this PR thanks for the contribution, which looks good |
Gotcha 👍! And thank you and @lwj5 for the reviews! |
…penAPITools#20823) * [go-server] Moved helper code from router and updated logger * [go-server] fixed imports for mux and chi * [go-server] fix go-api-server sample test
Addresses #20817
Moves the helper code not used in the NewRouter function within routers.go into the helpers.go file. This way the router.go file is clean for when users want to take over it when they want to add or update middlewares not yet supported by the generator.
This MR also updates the NewRouter function for chi middleware to use the logger file rather than hardcode the default chi logger. This allows for a user to take over the logger file without needing to take over the router file. That lets users be able to update the default logger logic which matches the behavior of the mux router.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)@antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) @lwj5 (2023/04)