Skip to content

Service sdk error #1319

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

Merged
merged 51 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a5fbb3d
service init, code to separate client and service
Jun 24, 2025
74efe84
server can be ran
Jun 27, 2025
4ae4afb
Merge branch 'server-sdk-main' of https://github.com/smithy-lang/smit…
Jun 27, 2025
172cc97
application in build.gradle.kts
Jun 27, 2025
e9007b1
detele non-finished code
Jun 27, 2025
03c15d0
ktlintformat
Jun 27, 2025
7c6ca67
change style
Jun 30, 2025
3a9ec4d
ktlintformat
Jun 30, 2025
7fb8705
add abstraction for service
Jun 30, 2025
859c02b
minor fix
Jun 30, 2025
7d5b92e
minor fix
Jun 30, 2025
1455933
cbor serde
Jul 2, 2025
39e67b6
Merge branch 'server-sdk-main' of github.com:smithy-lang/smithy-kotli…
Jul 2, 2025
40d4af8
fix
Jul 2, 2025
3db1971
formatting
Jul 2, 2025
219c66f
comment
Jul 2, 2025
d0b7d11
fix
Jul 2, 2025
4de4c84
fix
Jul 2, 2025
f9fb095
generate routing based on smithy file
Jul 2, 2025
313b758
ktlint format
Jul 2, 2025
8870ca4
service framework abstraction
Jul 3, 2025
c108529
ktlint foramt
Jul 3, 2025
344512b
logging
Jul 3, 2025
304550a
ktlint format
Jul 3, 2025
bdb9101
add ContentTypeGuard
Jul 4, 2025
40f69b0
ktlint
Jul 4, 2025
23590fe
fix content type guard
Jul 7, 2025
3b750b2
pull from server-sdk-main
Jul 8, 2025
9b14ed7
ktlint
Jul 8, 2025
68b985e
move some parameters, e.g. engine, port, log level to be chosen in ru…
Jul 8, 2025
50fae66
ktlint
Jul 8, 2025
5e5fac9
fix
Jul 8, 2025
0fa77aa
error handler
Jul 8, 2025
25b033e
ktlint
Jul 8, 2025
7ec323f
fix logging
Jul 9, 2025
a8f7f2c
Merge branch 'service-sdk-routing' of github.com:smithy-lang/smithy-k…
Jul 9, 2025
7aafc7e
error handler message envelope
Jul 9, 2025
1a62c87
use error handler for content guard type
Jul 9, 2025
047f8a2
fix
Jul 9, 2025
8f97cc9
Merge branch 'service-sdk-routing' of github.com:smithy-lang/smithy-k…
Jul 9, 2025
b917b44
fix
Jul 9, 2025
dfa7673
ktlint
Jul 9, 2025
8d95731
Merge branch 'service-sdk-routing' of github.com:smithy-lang/smithy-k…
Jul 9, 2025
25b5f08
Merge branch 'server-sdk-main' of github.com:smithy-lang/smithy-kotli…
Jul 10, 2025
20018b5
ktlint
Jul 10, 2025
1effbfb
fix
Jul 10, 2025
78e85df
remove manual input
Jul 11, 2025
c64a23d
fix
Jul 11, 2025
b8df0d3
abstraction of service framework and run type
Jul 14, 2025
7c24657
simplify the code
Jul 14, 2025
bec2933
fix
Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import software.amazon.smithy.kotlin.codegen.model.hasTrait
import software.amazon.smithy.kotlin.codegen.rendering.*
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ApplicationProtocol
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
import software.amazon.smithy.kotlin.codegen.service.ServiceStubGenerator
import software.amazon.smithy.kotlin.codegen.service.AbstractStubGenerator
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.knowledge.ServiceIndex
import software.amazon.smithy.model.neighbor.Walker
Expand Down Expand Up @@ -153,7 +153,7 @@ class CodegenVisitor(context: PluginContext) : ShapeVisitor.Default<Unit>() {
}

if (generateServiceProject) {
val serviceStubGenerator = ServiceStubGenerator(baseGenerationContext, writers, fileManifest)
val serviceStubGenerator: AbstractStubGenerator = settings.serviceStub.framework.getServiceFrameworkGenerator(baseGenerationContext, writers, fileManifest)
serviceStubGenerator.render()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const val RUNTIME_GROUP: String = "aws.smithy.kotlin"
val RUNTIME_VERSION: String = System.getProperty("smithy.kotlin.codegen.clientRuntimeVersion", getDefaultRuntimeVersion())
val KOTLIN_COMPILER_VERSION: String = System.getProperty("smithy.kotlin.codegen.kotlinCompilerVersion", "2.1.0")
val KTOR_VERSION: String = System.getProperty("smithy.kotlin.codegen.ktorVersion", "3.1.3")
val COROUTINES_VERSION: String = System.getProperty("smithy.kotlin.codegen.coroutinesVersion", "1.10.2")
val SERIALIZATION_PLUGIN: String = System.getProperty("smithy.kotlin.codegen.SerializationPlugin", "2.0.20")
val KOTLINX_VERSION: String = System.getProperty("smithy.kotlin.codegen.ktorKotlinxVersion", "1.9.0")
val KTOR_LOGGING_BACKEND_VERSION: String = System.getProperty("smithy.kotlin.codegen.ktorLoggingBackendVersion", "1.4.14")

enum class SourceSet {
Expand Down Expand Up @@ -146,8 +147,9 @@ data class KotlinDependency(
val KTOR_SERVER_LOGGING = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.plugins.calllogging", "io.ktor", "ktor-server-call-logging", KTOR_VERSION)
val KTOR_LOGGING_SLF4J = KotlinDependency(GradleConfiguration.Implementation, "org.slf4j", "ch.qos.logback", "logback-classic", KTOR_LOGGING_BACKEND_VERSION)
val KTOR_LOGGING_LOGBACK = KotlinDependency(GradleConfiguration.Implementation, "ch.qos.logback", "ch.qos.logback", "logback-classic", KTOR_LOGGING_BACKEND_VERSION)
val KTOR_SERVER_CONTENT_NEGOTIATION = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.plugins.contentnegotiation", "io.ktor", "ktor-server-content-negotiation", KTOR_VERSION)
val KTOR_SERVER_CBOR_SERDE = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.serialization.kotlinx.cbor", "io.ktor", "ktor-serialization-kotlinx-cbor", KTOR_VERSION)
val KTOR_SERVER_STATUS_PAGE = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.plugins.statuspages", "io.ktor", "ktor-server-status-pages-jvm", KTOR_VERSION)
val KOTLINX_CBOR_SERDE = KotlinDependency(GradleConfiguration.Implementation, "kotlinx.serialization", "org.jetbrains.kotlinx", "kotlinx-serialization-cbor", KOTLINX_VERSION)
val KOTLINX_JSON_SERDE = KotlinDependency(GradleConfiguration.Implementation, "kotlinx.serialization.json", "org.jetbrains.kotlinx", "kotlinx-serialization-json", KOTLINX_VERSION)
}

override fun getDependencies(): List<SymbolDependency> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,15 @@ object RuntimeTypes {
val ApplicationEngineFactory = symbol("ApplicationEngineFactory", "engine")

val Application = symbol("Application", "application")
val ApplicationCallClass = symbol("ApplicationCall", "application")
val ApplicationStopping = symbol("ApplicationStopping", "application")
val ApplicationStopped = symbol("ApplicationStopped", "application")
val ApplicationCreateRouteScopedPlugin = symbol("createRouteScopedPlugin", "application")
val ApplicationRouteScopedPlugin = symbol("RouteScopedPlugin", "application")
val applicationCall = symbol("call", "application")
val install = symbol("install", "application")

val BadRequestException = symbol("BadRequestException", "plugins")
}

object KtorServerRouting : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_CORE) {
Expand All @@ -513,11 +516,14 @@ object RuntimeTypes {
val requestReceive = symbol("receive", "request")
val requestUri = symbol("uri", "request")
val requestHttpMethod = symbol("httpMethod", "request")
val requestApplicationRequest = symbol("ApplicationRequest", "request")
val requestContentLength = symbol("contentLength", "request")
val requestContentType = symbol("contentType", "request")
val requestacceptItems = symbol("acceptItems", "request")

val responseText = symbol("respondText", "response")
val responseRespond = symbol("respond", "response")
val responseRespondBytes = symbol("respondBytes", "response")
val requestContentType = symbol("contentType", "request")
}

object KtorServerNetty : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_NETTY) {
Expand All @@ -527,6 +533,7 @@ object RuntimeTypes {
object KtorServerHttp : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_HTTP) {
val ContentType = symbol("ContentType")
val HttpStatusCode = symbol("HttpStatusCode")
val HttpHeaders = symbol("HttpHeaders")
val Cbor = symbol("Cbor", "ContentType.Application")
val Json = symbol("Json", "ContentType.Application")
}
Expand All @@ -545,4 +552,19 @@ object RuntimeTypes {
val Level = symbol("Level", "classic")
val LoggerContext = symbol("LoggerContext", "classic")
}

object KtorServerStatusPage : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_STATUS_PAGE) {
val StatusPages = symbol("StatusPages")
val exception = symbol("exception")
}

object KotlinxCborSerde : RuntimeTypePackage(KotlinDependency.KOTLINX_CBOR_SERDE) {
val Serializable = symbol("Serializable")
val Cbor = symbol("Cbor", "cbor")
val encodeToByteArray = symbol("encodeToByteArray")
}

object KotlinxJsonSerde : RuntimeTypePackage(KotlinDependency.KOTLINX_JSON_SERDE) {
val Json = symbol("Json")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fun writeGradleBuild(
{ w: AbstractCodeWriter<*> ->
if (generateServiceProject) {
w.write("application")
w.write("kotlin(#S) version #S", "plugin.serialization", SERIALIZATION_PLUGIN)
}
},
)
Expand Down
Loading
Loading