Deepak Nulu
10/24/2023, 6:37 AMhfhbd
10/24/2023, 7:04 AMDeepak Nulu
10/24/2023, 7:35 AMDeepak Nulu
10/24/2023, 7:37 AMhfhbd
10/24/2023, 7:39 AMDeepak Nulu
10/24/2023, 7:43 AMDeepak Nulu
10/24/2023, 7:47 AMhfhbd
10/24/2023, 7:54 AMKirill Grouchnikov
10/24/2023, 12:02 PMText
and compiling it at runtime, you can have that Text
emitted as a regular composable node. If you can be generic for the proposed runtime compilation, you can be generic without it with the exact same logic.Casey Brooks
10/24/2023, 1:56 PMwhen
block to handle the individual cases for method type, parameter types, or anything else.
@Composable
fun SwaggerUi(documentUrl: String) {
val openApiDocument by produceState<OpenApiDocument?>(initialValue = null, documentUrl) {
value = fetchOpenApiDocument(documentUrl)
}
if (openApiDocument == null) {
CircularProgressIndicator()
} else {
openApiDocument!!.paths.forEach { (apiPath, pathBody) ->
SwaggerUiPath(apiPath, pathBody)
}
}
}
@Composable
fun SwaggerUiPath(apiPath: String, pathBody: OpenApiPath) {
Text(apiPath)
pathBody.methods.forEach { (methodName, methodBody) ->
when (methodName.lowercase(Locale.ROOT)) {
"get" -> SwaggerUiGet(apiPath, pathBody, methodBody)
"post" -> SwaggerUiPost(apiPath, pathBody, methodBody)
"put" -> SwaggerUiPut(apiPath, pathBody, methodBody)
"delete" -> SwaggerUiDelete(apiPath, pathBody, methodBody)
}
}
}
Deepak Nulu
10/24/2023, 4:40 PMDeepak Nulu
10/24/2023, 4:45 PMCasey Brooks
10/24/2023, 4:54 PMApplier
and bootstrap the runtime, and everything else with the Slot Table, emitting nodes, recompositions, etc. is all handled by the Compose Compiler and core Compose Runtime library.
But from what it sounds like you are trying to make, you almost certainly do not need to mess any of that; you’re just writing a regular Compose app. You only need to focus on learning about Compose State Management and the Compose Material librariesDeepak Nulu
10/24/2023, 4:56 PM