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

Doesn't seem to support float types from Protobuf #7

Open
bstanley0811 opened this issue Jun 2, 2020 · 0 comments
Open

Doesn't seem to support float types from Protobuf #7

bstanley0811 opened this issue Jun 2, 2020 · 0 comments

Comments

@bstanley0811
Copy link

When generating the client from the protobuf file where a variable has type float, the client throws an error stating that the field in question doesn't exist. Also when reviewing the output of the generated files, I'm seeing that the client is generating an entire new resolver based on the object the float is associated with.

// filename: api.proto

service API {
   rpc GetSomething(GetSomethingRequest) returns (GetSomethingResponse);
}

message GetSomethingRequest {
  int64 id = 1;
}

message GetSomethingResponse {
    int64 id = 1;
    string name = 2;
    repeated Something;
}

message Something {
  int64 id = 1;
  float density = 2;   // type float associated to "Something" object
}
// Error message received when generating from this
panic: validation failed: packages.Load: /app/twirpql/resolver.go:132:15: r.API.Density undefined (type mySomething.API has no field or method Density)
/app/twirpql/resolver.go:132:28: undeclared name: req
// filename: resolver.go
// New resolver added here (this is similar in `generated.go`)

...

func (r *Resolver) Something() SomethingResolver {
	return &somethingResolver{r}
}

...

type somethingResolver struct{ *Resolver }

func (r *somethingResolver) Density(ctx context.Context, obj *api.Something) (float64, error) {
	return r.API.Density(ctx, req)
}

...

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

1 participant