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

Consider adding a mode where the generated code is dependency-free #303

Open
eliben opened this issue Feb 21, 2021 · 1 comment
Open

Consider adding a mode where the generated code is dependency-free #303

eliben opened this issue Feb 21, 2021 · 1 comment

Comments

@eliben
Copy link

eliben commented Feb 21, 2021

Currently the generated code has a dependency on pkg/runtime in this module, mostly to support Bind* functions.

While generated methods of the wrapper know exactly which types are needed in Go for the params, they call fairly generic Bind* functions that take these params via interface{}. This seems a bit backward - if we already have a concrete type, why bind it through a generic function that uses runtime dispatch?

It should be possible for the generated code to directly bind parameters - given a known concrete type it should be only a few lines of code per parameter. This would be faster, but more importantly dependency-free - the generated code would only be dependent on Echo (or other framework used).

@deepmap-marcinr
Copy link
Contributor

Yes, I've been meaning to do that, but it's really tricky. I've got a branch where it kinda works, but I have to break out all the special cases we have into their own functions and insert those into the spec. We'd also need to inline a whole lot of string manipulation functions. One day :)

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