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
Generating path for client is transforming all relevant types to string first. #977
Generating path for client is transforming all relevant types to string first. #977
Conversation
I see the failing Travis. Going for christmas party, will take care tomorrow (central europe time). :) |
@@ -334,13 +333,50 @@ func (g *Generator) generateResourceClient(pkgDir string, res *design.ResourceDe | |||
} | |||
} | |||
} | |||
initParams := func(att *design.AttributeDefinition) []*paramData { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return fmt.Sprintf({{ printf "%q" (pathTemplate .) }}, {{ pathParamNames . }}) | ||
*/}}// {{ $funcName }} computes a request path to the {{ .Route.Parent.Name }} action of {{ .Route.Parent.Parent.Name }}. | ||
func {{ $funcName }}({{ pathParams .Route }}) string { | ||
var params []interface{} |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Thank you for doing this! looks great. I suggested a couple of tweaks in the comments. Have fun at the party :) |
Thanks for the hints and patience! This time it even looks greener than the last time :). |
Found one more bug with the order of generated params, expect one more commit. I've realized that |
Route params need to be generated and used in Sprintf in a correct order. As the AttributeDefinition.Type is always a map, for route params we need to maintain this order by other means. In this case by manufacturing AttributeDefinition separately for each route param.
Thank you for the great PR! |
I have a feeling that it could be done with a bit less duplicity within
initParams
. Opened to any ideas (or just push a change) :).PR is fixing issue #961, which was partially fixed yesterday.