Skip to content

Abort server SDK generation when multiple protocols are specified #2980

@david-perez

Description

@david-perez

Until server-side multi-protocol support lands (see #2979), we should abort code generation when we encounter a model where the service shape is annotated with multiple protocol traits.

$version: "2"

namespace smithy.example

use aws.protocols#restJson1
use aws.protocols#awsJson1_1

@restJson1
@awsJson1_1
service MyService {
    version: "2023-09-12"
}

We currently pick the first protocol and ignore the rest. This can lead to user confusion, as they might reasonably expect that if code generation succeeds, the server SDK can honor what they modeled.

One possibility to implement this could be to add a software.amazon.smithy.model.validation.Validator that only gets loaded when generating servers (see #2752 for an example), which I think is preferable, as the error will surface in Smithy's consistent report format. Another is to simply throw a CodegenException in ServerProtocolLoader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions