utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
289 stars 39 forks source link

Fixes AST checks for source relative implementation path - before it was checking the path relative to proto file. #103

Closed bullgare closed 2 years ago

bullgare commented 2 years ago

There is an issue when protoc rewrites current handlers' implementations in case of source relative paths and protofile, descriptions, and implementations placed in separate directories.

As far as I understand, protoc handles the case with paths relative to source files by itself. So, in the unit-test provided it will convert given path of ../../internal/app/strings to internal/app/strings relative to proto file by itself (it will be integration/go_package_separate_impl_exists/internal/app/strings in our case). While astPkg function is not aware of this trick being done on protoc side. That's why this PR adds additional check with path updated from ../../internal/app/strings to internal/app/strings in case of source relative paths.

bullgare commented 2 years ago

@utrack could you please take a look?

bullgare commented 2 years ago

Forgot to add: if we simply check the updated relative path, it will fail a lot of use-cases that already exist. That's why we check both. But if you have an opinion on it, please let me know, I will update the implementation

utrack commented 2 years ago

Thanks! :)

bullgare commented 2 years ago

@utrack Could you please create a new release?