Skip to content

[WIP] Client generator #64

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 13 commits into from
Nov 18, 2017
Merged

[WIP] Client generator #64

merged 13 commits into from
Nov 18, 2017

Conversation

jeskew
Copy link
Contributor

@jeskew jeskew commented Nov 6, 2017

The generator for clients is still a WIP, but the current commits add some important type definitions.

@jeskew jeskew mentioned this pull request Nov 8, 2017
@jeskew
Copy link
Contributor Author

jeskew commented Nov 14, 2017

This is reviewable, but the design is still very much open to change if the feedback indicates as much.

/cc @chrisradek @AllanFly120

@jeskew
Copy link
Contributor Author

jeskew commented Nov 15, 2017

For reference, a sender generated from the Lambda model can be viewed here: https://paste.amazon.com/show/eskewj/1510768271

Imports from defaults are missing, and I spotted a few typos at first glance, but it's generally working as expected.

@jeskew
Copy link
Contributor Author

jeskew commented Nov 15, 2017

With the latest commits, a sender looks like this: https://paste.amazon.com/show/eskewj/1510774912

@chrisradek
Copy link
Contributor

Overall, I think the approach for customizations is reasonable. I've been trying to think up how we can simplify things (write a tool that generates the customization definitions?) but nothing I've come up with makes things easier.

I do have one question I haven't been able to figure out: what is the point for the ResolvableConfiguration? I understand it provides type-safety for additional configuration properties, but I don't quite understand when you would put something there.

@jeskew
Copy link
Contributor Author

jeskew commented Nov 16, 2017

The ResolvableConfig object also includes internal parameters (like _own_http_handler, which, per our offline discussion, should be renamed to something like _user_injected_http_handler).

@@ -0,0 +1,21 @@
{
"name": "@aws/config-resolver",
"version": "0.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure I understand correctly, this package is for resolving the configuration - based on a definition - during runtime, not build, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct

if (defaultValue !== undefined) {
input = defaultValue;
} else if (defaultProvider) {
input = defaultProvider(out);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does out need to be provided to the defaultProvider? Would we expect out to be mutated within the provider?

Copy link
Contributor Author

@jeskew jeskew Nov 17, 2017

Choose a reason for hiding this comment

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

out isn't expected to be mutated by the default provider, but the provider has access to configuration that has already been resolved. An example of when this is done is with serializers, whose constructors need access to base64 and utf8 encoders

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, but is that happening how we'd expect? It looks like out is an empty object to start with, and gets populated as properties are iterated over. What happens if we get to the serializer property before we've encountered the base64 or utf8 encoder properties?

Copy link
Contributor Author

@jeskew jeskew Nov 18, 2017

Choose a reason for hiding this comment

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

Order is significant, and properties are only allowed to depend on previously-resolved properties. That's the only way we can ensure defaults have been injected and normalization has occurred. (That's why the base64 and utf8 converters are resolved before serializers and parsers.)

@jeskew jeskew merged commit 1328083 into aws:master Nov 18, 2017
trivikr referenced this pull request in trivikr/aws-sdk-js-v3 Dec 10, 2018
* Add signing middleware

* WIP commit -- macbook keyboard nonresponsive, so transferring work to another computer

* WIP commit - switching back to the macbook

* Add a configuration resolver package

* Finish first-draft sender generator (reviewable but still WIP)

* Ensure generator can be run even if installed somewhere

* Improve naming of build-time configuration types

* Add applicator for signer

* Ensure empty lines are not indented in nested sections

* Rebase over master to incoporate HTTP handlers

* Add a destructor to HttpHandler and call it in service clients

* Ensure index file is generated for model packages

* Add preliminary ClientGenerator class
@lock
Copy link

lock bot commented Sep 26, 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 Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants