Skip to content
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

calibanGenClient dropping last directory in outputPath #2563

Open
edalex-ian opened this issue Feb 27, 2025 · 2 comments
Open

calibanGenClient dropping last directory in outputPath #2563

edalex-ian opened this issue Feb 27, 2025 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers tools Issue related to Caliban tools like code generation or schema comparison

Comments

@edalex-ian
Copy link

edalex-ian commented Feb 27, 2025

I've just upgraded caliban-codegen-sbt from version 2.5.1 to 2.9.2 and have noticed that when specifying an outputPath of a directory it's dropping the last part. For example, if I use the command:

calibanGenClient
  src/main/resources/schema.graphql
  src/main/scala/io/github/openequella/graphql/client/
  --splitFiles true
  --packageName io.github.openequella.graphql.client

All the files will end up in src/main/scala/io/github/openequella/graphql/. But if I add a superfluous last part to the outputPath like ignore/ then it works. For example this:

calibanGenClient
  src/main/resources/schema.graphql
  src/main/scala/io/github/openequella/graphql/client/ignore/
  --splitFiles true
  --packageName io.github.openequella.graphql.client

Nicely places the files in src/main/scala/io/github/openequella/graphql/client/.

As I said, the above statement worked fine in 2.5.1 but not in 2.9.2. (Mind you, other than that, the generated code is identical - just in the wrong directory.)

Update: Worked up to 2.7.2, broke in 2.8.0.

@ghostdogpr
Copy link
Owner

Maybe because of this? #2304

@edalex-ian
Copy link
Author

Yup, that looks like the cause:

scala> import java.io.File
import java.io.File

scala> new File("src/main/scala/io/github/openequella/graphql/client/").getParentFile
val res1: java.io.File = src/main/scala/io/github/openequella/graphql

I'd argue the original code you had could be kept, just modify the hard coded '/' to File.separator and that should work for Windows too.

@ghostdogpr ghostdogpr added bug Something isn't working good first issue Good for newcomers tools Issue related to Caliban tools like code generation or schema comparison labels Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers tools Issue related to Caliban tools like code generation or schema comparison
Projects
None yet
Development

No branches or pull requests

2 participants