This actually turned out to simplify the path conversion, as before allowing a single level of nesting was special-cased by replacing the first path segment with crate. The new algorithm no longer requires this, as it just replaces everything up to /src.
I've had to adjust the tests for the extract_module_name_from_path to match the new behaviour, but I have verified that the top-level tests still compile unchanged. I've also patched in my branch into my project and can confirm that it resolves my issue in #7 and that the macro outputs the same paths as I had manually specified.
In addition to the fix, I've taken the liberty to touch up some of the other macro functions with the same small clean-ups that I made to extract_module_name_from_path in a separate commit. Feel free to tell me off on that, I can rebase with only the first commit if you prefer.
Fixes #7 with the first approach described in https://github.com/ProbablyClem/utoipauto/issues/7#issuecomment-1888588610.
This actually turned out to simplify the path conversion, as before allowing a single level of nesting was special-cased by replacing the first path segment with
crate
. The new algorithm no longer requires this, as it just replaces everything up to/src
.I've had to adjust the tests for the
extract_module_name_from_path
to match the new behaviour, but I have verified that the top-level tests still compile unchanged. I've also patched in my branch into my project and can confirm that it resolves my issue in #7 and that the macro outputs the same paths as I had manually specified.In addition to the fix, I've taken the liberty to touch up some of the other macro functions with the same small clean-ups that I made to
extract_module_name_from_path
in a separate commit. Feel free to tell me off on that, I can rebase with only the first commit if you prefer.