Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -5,7 +5,6 @@
package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.aws.traits.protocols.AwsJson1_0Trait
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonProtocolMiddleware
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonProtocolParserGenerator
Expand All @@ -22,7 +21,7 @@ import software.amazon.smithy.model.shapes.ShapeId
* Handles generating the aws.protocols#awsJson1_0 protocol for services.
*
* @inheritDoc
* @see AwsHttpBindingProtocolGenerator
* @see HttpBindingProtocolGenerator
*/
@Suppress("ktlint:standard:class-naming")
class AwsJson1_0 : JsonHttpBindingProtocolGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.aws.traits.protocols.AwsJson1_1Trait
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonProtocolMiddleware
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonProtocolParserGenerator
Expand All @@ -23,7 +22,7 @@ import software.amazon.smithy.model.shapes.ShapeId
* Handles generating the aws.protocols#awsJson1_1 protocol for services.
*
* @inheritDoc
* @see AwsHttpBindingProtocolGenerator
* @see HttpBindingProtocolGenerator
*/
@Suppress("ktlint:standard:class-naming")
class AwsJson1_1 : JsonHttpBindingProtocolGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ 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.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
import software.amazon.smithy.kotlin.codegen.aws.protocols.formurl.QuerySerdeFormUrlDescriptorGenerator
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
Expand All @@ -33,7 +32,7 @@ import software.amazon.smithy.model.traits.XmlNameTrait
* Handles generating the aws.protocols#awsQuery protocol for services.
*
* @inheritDoc
* @see AwsHttpBindingProtocolGenerator
* @see HttpBindingProtocolGenerator
*/
class AwsQuery : QueryHttpBindingProtocolGenerator() {
override val protocol: ShapeId = AwsQueryTrait.ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.aws.traits.protocols.RestJson1Trait
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonProtocolParserGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.JsonHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
Expand All @@ -25,7 +24,7 @@ import software.amazon.smithy.model.shapes.StructureShape
* Handles generating the aws.protocols#restJson1 protocol for services.
*
* @inheritDoc
* @see AwsHttpBindingProtocolGenerator
* @see HttpBindingProtocolGenerator
*/
class RestJson1 : JsonHttpBindingProtocolGenerator() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.aws.traits.protocols.RestXmlTrait
import software.amazon.smithy.codegen.core.Symbol
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.xml.RestXmlSerdeDescriptorGenerator
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
Expand All @@ -26,9 +25,9 @@ import kotlin.contracts.contract
* Handles generating the aws.protocols#restJson1 protocol for services.
*
* @inheritDoc
* @see AwsHttpBindingProtocolGenerator
* @see HttpBindingProtocolGenerator
*/
open class RestXml : AwsHttpBindingProtocolGenerator() {
open class RestXml : HttpBindingProtocolGenerator() {

override val protocol: ShapeId = RestXmlTrait.ID
override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.DATE_TIME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
*/
package software.amazon.smithy.kotlin.codegen.aws.protocols

import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.StaticHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
import software.amazon.smithy.kotlin.codegen.model.*
import software.amazon.smithy.kotlin.codegen.model.traits.SyntheticClone
import software.amazon.smithy.kotlin.codegen.protocols.core.StaticHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.rendering.protocol.*
import software.amazon.smithy.kotlin.codegen.rendering.serde.CborParserGenerator
import software.amazon.smithy.kotlin.codegen.rendering.serde.CborSerializerGenerator
Expand All @@ -29,7 +28,7 @@ import software.amazon.smithy.protocol.traits.Rpcv2CborTrait
private const val ACCEPT_HEADER = "application/cbor"
private const val ACCEPT_HEADER_EVENT_STREAM = "application/vnd.amazon.eventstream"

class RpcV2Cbor : AwsHttpBindingProtocolGenerator() {
class RpcV2Cbor : HttpBindingProtocolGenerator() {
override val protocol: ShapeId = Rpcv2CborTrait.ID

// TODO Timestamp format is not used in RpcV2Cbor since it's a binary protocol. We seem to be missing an abstraction
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import software.amazon.smithy.kotlin.codegen.core.withBlock
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.model.knowledge.SerdeIndex
import software.amazon.smithy.kotlin.codegen.model.targetOrSelf
import software.amazon.smithy.kotlin.codegen.protocols.core.StaticHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingResolver
import software.amazon.smithy.kotlin.codegen.rendering.protocol.MutateHeadersMiddleware
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
Expand All @@ -24,7 +26,7 @@ import software.amazon.smithy.model.traits.TimestampFormatTrait

private const val QUERY_CONTENT_TYPE: String = "application/x-www-form-urlencoded"

abstract class QueryHttpBindingProtocolGenerator : AwsHttpBindingProtocolGenerator() {
abstract class QueryHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() {
override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.DATE_TIME

override fun getDefaultHttpMiddleware(ctx: ProtocolGenerator.GenerationContext): List<ProtocolMiddleware> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package software.amazon.smithy.kotlin.codegen.aws.protocols.json

import software.amazon.smithy.kotlin.codegen.aws.protocols.core.StaticHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.protocols.core.StaticHttpBindingResolver
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.pattern.UriPattern
import software.amazon.smithy.model.shapes.ServiceShape
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

package software.amazon.smithy.kotlin.codegen.aws.protocols.json

import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.serde.*
import software.amazon.smithy.model.shapes.OperationShape
Expand All @@ -16,7 +16,7 @@ import software.amazon.smithy.model.traits.TimestampFormatTrait
/**
* Abstract base class that all protocols using JSON as a document format can inherit from
*/
abstract class JsonHttpBindingProtocolGenerator : AwsHttpBindingProtocolGenerator() {
abstract class JsonHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() {

override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.EPOCH_SECONDS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.kotlin.codegen.aws.protocols

import io.kotest.matchers.string.shouldNotContain
import software.amazon.smithy.kotlin.codegen.test.*
import software.amazon.smithy.kotlin.codegen.test.lines
import software.amazon.smithy.kotlin.codegen.test.newTestContext
import software.amazon.smithy.kotlin.codegen.test.shouldContainOnlyOnceWithDiff
import software.amazon.smithy.kotlin.codegen.test.shouldNotContainOnlyOnceWithDiff
import software.amazon.smithy.kotlin.codegen.test.toSmithyModel
import kotlin.test.Test

class RpcV2CborTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import software.amazon.smithy.codegen.core.Symbol
import software.amazon.smithy.kotlin.codegen.aws.protocols.json.AwsJsonHttpBindingResolver
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.model.expectShape
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpBindingResolver
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.serde.*
Expand Down Expand Up @@ -157,7 +158,7 @@ class AwsHttpBindingProtocolGeneratorTest {
* renderThrowOperationError()
* getProtocolHttpBindingResolver()
*/
class TestableAwsHttpBindingProtocolGenerator : AwsHttpBindingProtocolGenerator() {
class TestableAwsHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() {
override fun renderDeserializeErrorDetails(
ctx: ProtocolGenerator.GenerationContext,
op: OperationShape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.kotlin.codegen.aws.protocols.core
package software.amazon.smithy.kotlin.codegen.protocols.core

import software.amazon.smithy.kotlin.codegen.model.expectTrait
import software.amazon.smithy.kotlin.codegen.model.hasTrait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.kotlin.codegen.aws.protocols.eventstream
package software.amazon.smithy.kotlin.codegen.protocols.eventstream

import software.amazon.smithy.codegen.core.CodegenException
import software.amazon.smithy.codegen.core.Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.kotlin.codegen.aws.protocols.eventstream
package software.amazon.smithy.kotlin.codegen.protocols.eventstream

import software.amazon.smithy.codegen.core.CodegenException
import software.amazon.smithy.codegen.core.Symbol
Expand Down
Loading
Loading