KsIntrospectable
annotation class KsIntrospectable
Annotation tagging an interface for processing by the compiler plugin.
This should be placed on interfaces which extend IntrospectableRpcService.
Samples
// Extend IntrospectableRpcService and add @KsIntrospectable.
// The compiler plugin generates a getIntrospection() implementation
// that returns metadata about the service and its endpoints.Content copied to clipboard
val service = object : CatalogService {
override suspend fun search(query: String): String = "result"
override suspend fun count(): Int = 42
}
val env = ksrpcEnvironment { }
val serialized = service.serialized(env)
val stub = serialized.toStub<CatalogService, String>()
// Get the IntrospectionService for this service.
val introspection = stub.getIntrospection()
// Query the service name.
val name = introspection.getServiceName()
// List all endpoints.
val endpoints = introspection.getEndpoints()
// Get detailed info about a specific endpoint (input/output types).
val searchInfo = introspection.getEndpointInfo("search")
val inputType = searchInfo.input
val outputType = searchInfo.outputContent copied to clipboard