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

fix: kotlin schema extractor fixes #940

Merged
merged 1 commit into from Feb 15, 2024

Conversation

worstell
Copy link
Collaborator

fixes #938
fixes #934
fixes #929

This change fixes the java class resolution issue in module POMs, but I still unfortunately haven't figured out how to do the same for unit tests run from kotlin-runtime/ftl-runtime. So, the change was validated locally instead of in unit tests.

with the given Echo.kt:

package ftl.echo

import ftl.builtin.Empty
import xyz.block.ftl.Context
import xyz.block.ftl.Verb
import java.time.OffsetDateTime
import java.util.ArrayList
import java.util.HashMap

class InvalidInput(val field: String) : Exception()

data class EchoRequest(val name: String?)
data class EchoResponse(
  val message: String,
  val time: OffsetDateTime? = null,
  val arrayList: ArrayList<Empty> = ArrayList(),
  val hashMap: HashMap<String, String> = HashMap()
)
 
@Throws(InvalidInput::class)
@Verb
fun echo(context: Context, req: EchoRequest): EchoResponse {
  return EchoResponse(message = "Hello, ${req.name ?: "anonymous"}!")
}
Screenshot 2024-02-14 at 4 11 10 PM

@worstell worstell force-pushed the worstell/20240214-kotlin-schema-extractor-fixes branch from f5226c6 to c41e0e1 Compare February 15, 2024 00:17
@@ -184,6 +184,7 @@
<disableDefaultRuleSets>true</disableDefaultRuleSets>
<classPath>${generated.classpath}</classPath>
<jvmTarget>${java.version}</jvmTarget>
<jdkHome>${java.home}</jdkHome>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super bizarre, you'd think it would be able to figure this out itself...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know 😢 thankfully i came across this issue, which pointed me to this solution

@worstell worstell merged commit e6c6ccf into main Feb 15, 2024
11 checks passed
@worstell worstell deleted the worstell/20240214-kotlin-schema-extractor-fixes branch February 15, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants