Skip to content
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

Embed runtime code into generated boilerplate #20

Open
deepmap-marcinr opened this issue May 28, 2019 · 1 comment
Open

Embed runtime code into generated boilerplate #20

deepmap-marcinr opened this issue May 28, 2019 · 1 comment

Comments

@deepmap-marcinr
Copy link
Contributor

We currently have generic handlers for parameters in the runtime package. These use either reflection or the swagger spec to generically handle any parameter.

A much better, though more difficult approach would be to generate the specific code to marshal and unmarshal each parameter from a query. We know the exact style, format and content for each parameter at generation time, so we only need a subset of the generic code to handle each, and that could be embedded without any conditional type logic where it's used.

The thought of the template code to do this, though, makes me shake with fear.

@chrusty
Copy link
Contributor

chrusty commented Jun 5, 2019

I've been working on this recently. I raised a PR in my fork so you can see the changes:

chrusty#1

I agree that the template code was too dirty to proceed with, so I've implemented it using helper-functions. It still needs some work, but let me know if this is going in the right direction because it would be great to merge this back.

I've added a new choice for the generate command-line option called "richclient", which generates this new client code instead of the existing one (as a way to maintain backwards-compatibility).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants