Skip to content

Service sdk json #1367

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 135 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 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
493d888
fix and set up
Jul 10, 2025
51419e3
test set up
Jul 10, 2025
81ee058
authentication set up
Jul 10, 2025
e2b9dcb
fix
Jul 11, 2025
c774456
kitlint
Jul 11, 2025
c670441
error handler for auth
Jul 11, 2025
3e705f7
generate all the files
Jul 11, 2025
984fdec
cbor serializer fix
Jul 11, 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
7d2dd2c
Merge branch 'service-sdk-error' of github.com:smithy-lang/smithy-kot…
Jul 14, 2025
9e7b8e2
Merge branch 'service-sdk-authentication' of github.com:smithy-lang/s…
Jul 14, 2025
e66343f
Merge branch 'server-sdk-main' of github.com:smithy-lang/smithy-kotli…
Jul 14, 2025
40e5f47
fix
Jul 14, 2025
08e85c8
merge
Jul 14, 2025
3493c66
test works
Jul 14, 2025
274c6b9
ktlint
Jul 14, 2025
512b84e
auth
Jul 14, 2025
337033a
fix
Jul 14, 2025
323df57
merge
Jul 14, 2025
dfc38b3
end to end test for post
Jul 15, 2025
0bc3711
fix testing
Jul 15, 2025
32ee46f
additional testing
Jul 15, 2025
6bfe679
fix
Jul 15, 2025
73feb6c
add test, accept content type and some improvement of the code
Jul 15, 2025
336c309
add closing test
Jul 15, 2025
82351b3
more tests
Jul 15, 2025
cd9f87e
add parameters
Jul 16, 2025
bad0985
add testing
Jul 16, 2025
5a103ec
fix engine factory
Jul 16, 2025
a98ca12
fix
Jul 16, 2025
6cac4e7
merge
Jul 16, 2025
a2abdaf
fix
Jul 16, 2025
bad5be5
fix
Jul 16, 2025
2a12023
add print for testing
Jul 16, 2025
95165df
fix
Jul 16, 2025
db2a8d3
fix
Jul 16, 2025
a5bc47b
fix circular dependency now all works
Jul 17, 2025
b1cb5ae
fix
Jul 17, 2025
9dfa590
remove println
Jul 17, 2025
c666db7
test
Jul 17, 2025
42f8ec7
test
Jul 17, 2025
95f77e1
test
Jul 17, 2025
26a4ef8
port listener
Jul 17, 2025
d1c5224
ktlint
Jul 17, 2025
faa549b
fix
Jul 17, 2025
a67198f
fix
Jul 18, 2025
b8fd8ed
fix
Jul 18, 2025
6888599
constraints
Jul 20, 2025
3b848c0
add required constraints
Jul 20, 2025
5e8fd00
fix naming
Jul 21, 2025
95e76cc
Merge branch 'service-sdk-testing' of github.com:smithy-lang/smithy-k…
Jul 21, 2025
05bf6c2
add unit test for constraints
Jul 21, 2025
825e67b
Merge branch 'server-sdk-main' of github.com:smithy-lang/smithy-kotli…
Jul 22, 2025
4a04596
fix
Jul 22, 2025
ed31915
separate test files
Jul 22, 2025
70db8ef
fix
Jul 22, 2025
dfd3530
test
Jul 23, 2025
07693cb
fix
Jul 23, 2025
57b92bb
fix error message and add double nested list unique items test
Jul 23, 2025
8386a13
fix
Jul 23, 2025
34e1a24
json protocol setup
Jul 23, 2025
28fc3d3
httplabel and httpquery
Jul 23, 2025
74fc121
fix
Jul 25, 2025
0eb095f
httpquery and httplabel casting
Jul 25, 2025
8d49037
content type and accept type
Jul 25, 2025
6f77523
timestamp format trait
Jul 26, 2025
341c1f5
httpPayload
Jul 27, 2025
f8fef99
httpQueryParams
Jul 28, 2025
8c48223
fix
Jul 28, 2025
4fd9c2f
merge
Jul 28, 2025
36dea0e
fix
Jul 28, 2025
a377629
merge
Jul 28, 2025
c5f9cc2
httpErrorTrait
Jul 29, 2025
669de1a
fix constraints
Jul 29, 2025
91d0c36
httpHeader
Jul 30, 2025
9be2fb9
httpPrefixHeader
Jul 30, 2025
858fd3c
json unit test
Aug 4, 2025
4eae182
json unit test
Aug 4, 2025
64e93b7
json unit test
Aug 5, 2025
2cbaa88
fix
Aug 6, 2025
c313ca1
fix
Aug 6, 2025
6a8c58c
fix
Aug 6, 2025
bde20e9
fix
Aug 6, 2025
875cf36
fix
Aug 7, 2025
6563559
klintformat
Aug 7, 2025
6252976
fix
Aug 12, 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 @@ -7,6 +7,7 @@ package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.aws.traits.protocols.AwsQueryErrorTrait
import software.amazon.smithy.aws.traits.protocols.AwsQueryTrait
import software.amazon.smithy.codegen.core.Symbol
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AbstractQueryFormUrlSerializerGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.QueryHttpBindingProtocolGenerator
Expand Down Expand Up @@ -86,6 +87,14 @@ private class AwsQuerySerializerGenerator(
members: List<MemberShape>,
writer: KotlinWriter,
): FormUrlSerdeDescriptorGenerator = AwsQuerySerdeFormUrlDescriptorGenerator(ctx.toRenderingContext(protocolGenerator, shape, writer), members)

override fun errorSerializer(
ctx: ProtocolGenerator.GenerationContext,
errorShape: StructureShape,
members: List<MemberShape>,
): Symbol {
TODO("Used for service-codegen. Not yet implemented")
}
}

private class AwsQueryXmlParserGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ private class Ec2QuerySerializerGenerator(
members: List<MemberShape>,
writer: KotlinWriter,
): FormUrlSerdeDescriptorGenerator = Ec2QuerySerdeFormUrlDescriptorGenerator(ctx.toRenderingContext(protocolGenerator, shape, writer), members)

override fun errorSerializer(
ctx: ProtocolGenerator.GenerationContext,
errorShape: StructureShape,
members: List<MemberShape>,
): Symbol {
TODO("Used for service-codegen. Not yet implemented")
}
}

private class Ec2QueryParserGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ class RestJson1 : JsonHttpBindingProtocolGenerator() {
writer: KotlinWriter,
) {
super.renderSerializeHttpBody(ctx, op, writer)
if (ctx.settings.build.generateServiceProject) return

val resolver = getProtocolHttpBindingResolver(ctx.model, ctx.service)
if (!resolver.hasHttpBody(op)) return

if (!resolver.hasHttpRequestBody(op)) return

// restjson1 has some different semantics and expectations around empty structures bound via @httpPayload trait
// * empty structures get serialized to `{}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ class AwsHttpBindingProtocolGeneratorTest {
): Symbol {
error("Unneeded for test")
}

override fun errorSerializer(
ctx: ProtocolGenerator.GenerationContext,
errorShape: StructureShape,
members: List<MemberShape>,
): Symbol {
error("Unneeded for test")
}
}

override val protocol: ShapeId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ class MockHttpProtocolGenerator(model: Model) : HttpBindingProtocolGenerator() {
val symbol = ctx.symbolProvider.toSymbol(shape)
name = "serialize" + StringUtils.capitalize(symbol.name) + "Payload"
}

override fun errorSerializer(
ctx: ProtocolGenerator.GenerationContext,
errorShape: StructureShape,
members: List<MemberShape>,
): Symbol {
error("Unneeded for test")
}
}

override fun operationErrorHandler(ctx: ProtocolGenerator.GenerationContext, op: OperationShape): Symbol = buildSymbol {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ data class KotlinDependency(
// Ktor server dependencies
// FIXME: version numbers should not be hardcoded, they should be setting dynamically based on the Gradle library versions
val KTOR_SERVER_CORE = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server", "io.ktor", "ktor-server-core", KTOR_VERSION)
val KTOR_SERVER_UTILS = KotlinDependency(GradleConfiguration.Implementation, "io.ktor", "io.ktor", "ktor-server-core", KTOR_VERSION)
val KTOR_SERVER_NETTY = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.netty", "io.ktor", "ktor-server-netty", KTOR_VERSION)
val KTOR_SERVER_CIO = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.cio", "io.ktor", "ktor-server-cio", KTOR_VERSION)
val KTOR_SERVER_JETTY_JAKARTA = KotlinDependency(GradleConfiguration.Implementation, "io.ktor.server.jetty.jakarta", "io.ktor", "ktor-server-jetty-jakarta", KTOR_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ object RuntimeTypes {
val BadRequestException = symbol("BadRequestException", "plugins")
}

object KtorServerUtils : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_UTILS) {
val AttributeKey = symbol("AttributeKey", "util")
}

object KtorServerRouting : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_CORE) {
val routing = symbol("routing", "routing")
val route = symbol("route", "routing")
Expand Down Expand Up @@ -558,6 +562,9 @@ object RuntimeTypes {
val HttpHeaders = symbol("HttpHeaders")
val Cbor = symbol("Cbor", "ContentType.Application")
val Json = symbol("Json", "ContentType.Application")
val Any = symbol("Any", "ContentType.Application")
val OctetStream = symbol("OctetStream", "ContentType.Application")
val PlainText = symbol("Plain", "ContentType.Text")
}

object KtorServerLogging : RuntimeTypePackage(KotlinDependency.KTOR_SERVER_LOGGING) {
Expand Down
Loading
Loading