aws / aws/aws-toolkit-vscode

Download code bindings for Typescript 3+ generates code with a typo in marshaller.ts file

Open
#1,160 7 comments 2 reactions 0 assignees View on GitHub
bug eventbridge-schemas
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

**Describe the bug**

When downloading code bindings, in the auto-generated file "marshaller.ts" (./marshaller/marshaller.ts) there is an error in a import statement; ```import { AWSEvent } from '../aWSEvent';``` should be ```import { AWSEvent } from '../AWSEvent';```

**To Reproduce**

In vs-code is selected the AWS tab I selected discovered-schemas, selected download Code Binding on the following schema:

`{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Todo"
},
"paths": {},
"components": {
"schemas": {
"AWSEvent": {
"type": "object",
"required": [
"detail-type",
"resources",
"detail",
"id",
"source",
"time",
"region",
"version",
"account"
],
"x-amazon-events-detail-type": "todo",
"x-amazon-events-source": "example.api.todo",
"properties": {
"detail": {
"$ref": "#/components/schemas/Todo"
},
"account": {
"type": "string"
},
"detail-type": {
"type": "string"
},
"id": {
"type": "string"
},
"region": {
"type": "string"
},
"resources": {
"type": "array",
"items": {
"type": "object"
}
},
"source": {
"type": "string"
},
"time": {
"type": "string",
"format": "date-time"
},
"version": {
"type": "string"
}
}
},
"Todo": {
"type": "object",
"required": [
"eventID",
"awsRegion",
"eventSourceARN",
"eventVersion",
"eventSource",
"eventName",
"dynamodb"
],
"properties": {
"dynamodb": {
"$ref": "#/components/schemas/Dynamodb"
},
"awsRegion": {
"type": "string"
},
"eventID": {
"type": "string"
},
"eventName": {
"type": "string"
},
"eventSource": {
"type": "string"
},
"eventSourceARN": {
"type": "string"
},
"eventVersion": {
"type": "string"
}
}
},
"Dynamodb": {
"type": "object",
"required": [
"NewImage",
"ApproximateCreationDateTime",
"Keys"
],
"properties": {
"Keys": {
"$ref": "#/components/schemas/Keys"
},
"NewImage": {
"$ref": "#/components/schemas/NewImage"
},
"ApproximateCreationDateTime": {
"type": "number"
}
}
},
"Keys": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string"
}
}
},
"NewImage": {
"type": "object",
"required": [
"createdAt",
"abc",
"color",
"size",
"checked",
"isBig",
"stringAndNumber",
"id",
"text",
"stringOrNumber",
"updatedAt"
],
"properties": {
"abc": {
"$ref": "#/components/schemas/Abc"
},
"checked": {
"type": "boolean"
},
"color": {
"type": "number"
},
"createdAt": {
"type": "integer",
"format": "int64"
},
"id": {
"type": "string"
},
"isBig": {
"type": "boolean"
},
"size": {
"type": "number"
},
"stringAndNumber": {
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "number"
}
]
}
},
"stringOrNumber": {
"type": "number"
},
"text": {
"type": "string"
},
"updatedAt": {
"type": "integer",
"format": "int64"
}
}
},
"Abc": {
"type": "object"
}
}
}
}`

The generated code (./marshaller/marshaller.ts) had a typo in a import statment.

**Expected behavior**

```import { AWSEvent } from '../aWSEvent';``` should be ```import { AWSEvent } from '../AWSEvent';```

**Desktop:**

- OS: Linux x64 5.4.0-7634-generic
- Visual Studio Code Version: 1.46.0
- AWS Toolkit Version: 1.10.0

Contributor guide

Open the contributing guide

Research direction

Start with the generated ./marshaller/marshaller.ts file and reproduce the issue through the VS Code AWS tab's discovered-schemas code-binding download using the schema in the report. Trace the code-binding generator that produces the import, then verify that the generated path preserves AWSEvent casing and that the resulting TypeScript code can resolve the import.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.