utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
289 stars 39 forks source link

genhandler: create own registry #98

Open utrack opened 4 years ago

utrack commented 4 years ago

ref #97, preparation for v3

Currently, genhandler is closely tied up to protobuf & grpc-gateway structures.

Instead of using external abstractions and calling functions from the template, we should build our own registry that'll already have all the data we would need to generate that template. This will make it easier to change templates.

See this example: https://github.com/utrack/clay/blob/master/cmd/protoc-gen-goclay/genhandler/tpl_servicedesc.go#L8 It'll be easier if every Service would already have .GoTypeName field embedded in it.

This map contains all the functions that are called from the template: https://github.com/utrack/clay/blob/master/cmd/protoc-gen-goclay/genhandler/template.go#L224