Skip to content

chore: add updated RDS DATA smithy model #370

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 17 commits into from
Oct 2, 2019

Conversation

AllanZhengYP
Copy link
Contributor

  • header default middleware
  • expect continue middleare

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AllanZhengYP AllanZhengYP added the smithy-codegen Changes regarding supporting smithy model. Will be merged to smithy-codegen branch label Sep 19, 2019
@AllanZhengYP
Copy link
Contributor Author

Well, I have to update all middlewares to pass the CI

@AllanZhengYP AllanZhengYP changed the title chore: add http request type guard for middlewares chore: add http request type guard to middlewares Sep 19, 2019
@srchase
Copy link
Contributor

srchase commented Sep 26, 2019

The shapes are failing in a few places:

  1. This one can be resolved by moving to TypeScript 3.7 (tested against Version 3.7.0-dev.20190926)
models/com/amazon/rdsdataservice.ts(31,15): error TS2339: Property 'stringValues' does not exist on type 'Pick<UnknownVariant & { stringValues?: string[] | undefined; booleanValues?: boolean[] | undefined; arrayValues?: Pick<UnknownVariant & ..., never>[] | undefined; blobValues?: Uint8Array[] | undefined; doubleValues?: number[] | undefined; longValues?: number[] | undefined; }, never>'.
  1. Need to update how SmithyException is extending from Error (resolved in Add fixes for symbols and errors smithy-lang/smithy-typescript#3)
models/com/amazon/rdsdataservice.ts(48,12): error TS2416: Property 'message' in type 'BadRequestException' is not assignable to the same property in base type 'SmithyException'.
  Type 'string | undefined' is not assignable to type 'string'.
    Type 'undefined' is not assignable to type 'string'.
  1. Record is a reserved word. The type is aliased to _Record. Record needs to be aliased when referenced within another structure. (resolved in Add fixes for symbols and errors smithy-lang/smithy-typescript#3)
models/com/amazon/rdsdataservice.ts(378,28): error TS2314: Generic type 'Record' requires 2 type argument(s).
  1. Needs further research. Still does not work with 3.7.
models/com/amazon/rdsdataservice.ts(503,13): error TS2456: Type alias 'Value' circularly references itself.

@mtdowling
Copy link
Member

Need to update how SmithyException is extending from Error (resolved in smithy-lang/smithy-typescript#3)

Fixed in generator

Record is a reserved word. The type is aliased to _Record. Record needs to be aliased when referenced within another structure. (resolved in smithy-lang/smithy-typescript#3)

Fixed in generator

@AllanZhengYP AllanZhengYP changed the title chore: add http request type guard to middlewares chore: add updated RDS DATA smithy model Sep 26, 2019
@AllanZhengYP
Copy link
Contributor Author

AllanZhengYP commented Sep 26, 2019

Record is a reserved word. The type is aliased to _Record. Record needs to be aliased when referenced within another structure. (resolved in smithy-lang/smithy-typescript#3)

Just updated the PR with newest model. The _Record class is not referenced anywhere(https://github.com/AllanFly120/aws-sdk-js-v3/blob/57fc88f8cdc8ee6eff51e2e091c968a4053e6eb8/clients/node/client-rds-data-node/models/com/amazon/rdsdataservice.ts#L378). Is this expected?

@AllanZhengYP AllanZhengYP force-pushed the smithy-codegen branch 2 times, most recently from 6f7f964 to 96bb132 Compare September 26, 2019 22:46
* smithy-typescript: ddd6257c956381a8a16fe224d3a9de8286e7ed5f
* smithy: 17df2312a0fd9bde2e4c5c0c61c5602cd20bc27f
): ExecuteStatementResponse {
let data: any = {};
if (output.body) {
data = JSON.parse(output.body);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the output.body is not a binary data. It's actually Readable in node and Blob in browser. You should call streamcollector transfer them into binary. Example can be found here:

private resolveBody(
body: HttpResponse<StreamType>["body"] = ""
): Promise<Uint8Array | string> {
if (typeof body === "string") {
return Promise.resolve(body);
}
let bufferPromise: Promise<Uint8Array>;
if (ArrayBuffer.isView(body)) {
bufferPromise = Promise.resolve(
new Uint8Array(body.buffer, body.byteOffset, body.byteLength)
);
} else if (isArrayBuffer(body)) {
bufferPromise = Promise.resolve(new Uint8Array(body, 0, body.byteLength));
} else {
bufferPromise = this.bodyCollector(body);
}
return bufferPromise;
}
, You may need to import a runtime-specific stream collector like node collector and browser collector

});
}

export function executeStatementAwsRestJson1_1Deserialize(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deserializers should be async functions that return a promise according to our definition

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (smithy-codegen@20081b7). Click here to learn what that means.
The diff coverage is 92.3%.

Impacted file tree graph

@@                Coverage Diff                @@
##             smithy-codegen     #370   +/-   ##
=================================================
  Coverage                  ?   97.28%           
=================================================
  Files                     ?       69           
  Lines                     ?     1177           
  Branches                  ?      215           
=================================================
  Hits                      ?     1145           
  Misses                    ?       32           
  Partials                  ?        0
Impacted Files Coverage Δ
...kages/fetch-http-handler/src/fetch-http-handler.ts 97.61% <100%> (ø)
packages/retry-middleware/src/retryMiddleware.ts 100% <100%> (ø)
...ackages/node-http-handler/src/node-http-handler.ts 96.42% <100%> (ø)
packages/middleware-header-default/src/index.ts 91.66% <87.5%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20081b7...1465a66. Read the comment docs.

@AllanZhengYP
Copy link
Contributor Author

The (de)serializer looks good to me. 🚢

@AllanZhengYP AllanZhengYP merged commit 2b77246 into aws:smithy-codegen Oct 2, 2019
@@ -0,0 +1,44 @@
export const TYPE = "__type";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could move this file into a shared package in the future. This is fine for now.

@@ -68,6 +69,6 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-sourcemaps": "^0.4.2",
"typedoc": "^0.14.2",
"typescript": "~3.4.0"
"typescript": "^3.7.0-dev.20190926"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably shouldn't rely on a dev build

export function executeStatementAwsRestJson1_1Serialize(
input: ExecuteStatementRequest
): HttpRequest {
let body: any = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A performance improvement here would be to use a streaming JSON serializer rather than needing to store the JSON object in an intermediate value. This should be done at some point but isn't a blocker right now.

});
}

function executeStatementAwsRestJson1_1DeserializeError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs work. It should check the x-amzn-ErrorType header for the ID of the error and use that. If that's not found, then it should fall back to status codes.

@lock
Copy link

lock bot commented Oct 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
smithy-codegen Changes regarding supporting smithy model. Will be merged to smithy-codegen branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants