Skip to content

Commit

Permalink
pr review changes :)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman committed Mar 14, 2024
1 parent 6eba799 commit cd12047
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,15 @@ class SchemaExtractor(
private fun extractVerb(verb: KtNamedFunction): Verb {
val verbSourcePos = verb.getLineAndColumn()

var requestRef = Type(unit = xyz.block.ftl.v1.schema.Unit())
if (verb.valueParameters.size > 1) {
val ref = verb.valueParameters.last()?.let {
val position = it.getLineAndColumn().toPosition()
return@let it.typeReference?.resolveType()?.toSchemaType(position)
}
ref?.let { requestRef = it }

}
val requestRef = verb.valueParameters.takeIf { it.size > 1 }?.last()?.let {
val position = it.getLineAndColumn().toPosition()
return@let it.typeReference?.resolveType()?.toSchemaType(position)
} ?: Type(unit = xyz.block.ftl.v1.schema.Unit())

var returnRef = Type(unit = xyz.block.ftl.v1.schema.Unit())
val ref = verb.createTypeBindingForReturnType(bindingContext)?.let {
val returnRef = verb.createTypeBindingForReturnType(bindingContext)?.let {
val position = it.psiElement.getLineAndColumn().toPosition()
return@let it.type.toSchemaType(position)
}
ref?.let { returnRef = it }
} ?: Type(unit = xyz.block.ftl.v1.schema.Unit())

val metadata = mutableListOf<Metadata>()
extractIngress(verb, requestRef, returnRef)?.apply { metadata.add(Metadata(ingress = this)) }
Expand Down

0 comments on commit cd12047

Please sign in to comment.