-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Fix package name extraction in code generation #1116
Fix package name extraction in code generation #1116
Conversation
Hi! That change makes one of the scripted tests fail, can you check it? ( |
2617984
to
65c6e21
Compare
It looks good! Do you mind adding a few unit tests to capture the different cases? Ideally with the 2 lines moved to a function. |
55a8e95
to
6f94102
Compare
Done |
test("Package name is empty or default if path doesn't follow correct format") { | ||
assert(packageAndObject("a/b/c", None, None))( | ||
equalTo(None -> "Client") | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to join the assert
with &&
, otherwise only the last one will be executed (it's assert
from zio-test, not the regular scala assert, it's a pure function that returns a test result).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
6f94102
to
b6bc7d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The old regex doesn't work properly on paths such as "src/main/scala/company/service/infra/graphql/model.scala". This returns "infra/graphql" as the package name. This is because of [] square brackets to match on one of scala, play or app. I replaced that with a non capturing regex group and that works as expected returning "company/service/infra/graphql" as the package name