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

add support for type meta to service method arguments #31

Merged
merged 3 commits into from
Aug 20, 2023

Conversation

pkieltyka
Copy link
Member

@pkieltyka pkieltyka commented Aug 13, 2023

This PR expands on the type.go.tmpl renaming it to field.go.tmpl so it can account for the type meta annotations. A field can be used in many places outside of the struct, so moved some of the logic around, and added some flags if to include json / struct tags or not, etc.

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

LGTM

@VojtechVitek VojtechVitek merged commit 8e1db6a into master Aug 20, 2023
@VojtechVitek VojtechVitek deleted the support-succinct branch August 20, 2023 12:24
@pkieltyka
Copy link
Member Author

Thanks for reviewing

{{- $inputVar := "nil" -}}
{{- $outputVar := "nil" -}}
{{- if $inputs | len}}
{{- $inputVar = "in"}}
in := struct {
{{- range $i, $input := $inputs}}
Arg{{$i}} {{template "type" dict "Type" $input.Type "Optional" $input.Optional "TypeMap" $typeMap "TypePrefix" $typePrefix}} `json:"{{$input.Name}}"`
Arg{{$i}} {{template "field" dict "Name" $input.Name "Type" $input.Type "Optional" $input.Optional "TypeMap" $typeMap "TypePrefix" $typePrefix "TypeMeta" $input.Meta "JsonTags" true}}
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

2 participants