Skip to content

Error: Smithy typescript codegen generates un-buildable code for awsJson services when using streaming #1051

Open
@AnirudhKonduru

Description

@AnirudhKonduru

Produces the following output when npm run build is run:

> concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'
...
$ tsc -p tsconfig.types.json
[build:cjs] src/protocols/Aws_json1_0.ts(52,36): error TS2552: Cannot find name 'de_string'. Did you mean 'String'?
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[build:cjs] yarn run build:cjs exited with code 2
[build:types] src/protocols/Aws_json1_0.ts(52,36): error TS2552: Cannot find name 'de_string'. Did you mean 'String'?
[build:es] src/protocols/Aws_json1_0.ts(52,36): error TS2552: Cannot find name 'de_string'. Did you mean 'String'?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[build:types] yarn run build:types exited with code 1
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[build:es] yarn run build:es exited with code 2

To reproduce, build this minimal main.smithy file:

$version: "2"

namespace smithy.example
use aws.protocols#awsJson1_0

@awsJson1_0
service ExampleService {
    version: "2022-01-01"
    operations: [Echo]
}

structure MessageItem {
    content: String
}
@streaming
union MessageStream {
    content: MessageItem
}

@output
structure EchoResponse {
    @httpHeader("x-custom-header")
    customHeader: String
    @httpPayload
    stream: MessageStream
}

@http(code: 200, method: "POST", uri: "/echo")
operation Echo {
    input := {
        message: String
    } 
    output: EchoResponse
}

With the following dependencies:

"software.amazon.smithy.typescript:smithy-typescript-codegen:0.18.0",
"software.amazon.smithy.typescript:smithy-aws-typescript-codegen:0.18.0",
"software.amazon.smithy:smithy-aws-traits:1.39.0"

Tested with smithy-cli versions 1.33, 1.34, 1.40.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions