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

Spec compatibility for go server and client #245

Closed
wants to merge 3 commits into from
Closed

Spec compatibility for go server and client #245

wants to merge 3 commits into from

Conversation

ofpiyush
Copy link
Contributor

@ofpiyush ofpiyush commented Jun 20, 2020

Issue #, if available: #244

Through a PR on twirpy, I discovered that the go and python official implementations do not conform to the spec wrt CamelCasing the URL. There is a difference between the python client and go server implementation as well.

My initial assumption was go might be the reference implementation and spec kind of follows the behaviour in go generated code. So I opened #244 to ask if/how we should add clarification on the spec.

@spenczar pointed out that it is probably supposed to be the other way around.

Overview of choices

The major trade off seems to be between breaking change in spec vs the go server implementation.

The fact that this hasn't been an issue so far is most probably because people using twirp, especially in other languages, make their service and method names CamelCased anyway.
That might be at least some weak evidence in favour of doubling down on camel case requirement for all implementations.

On the other hand, it an also be seen as the impact of a breaking change might not be that big.

If we think of twirp as a serious alternative to gRPC and REST, we're still in the early stages of the lifetime penetration it will have across languages. This project relies heavily on community implementations of the spec for that.

A move to maintain simplicity of the spec might be of greater importance from that view.

Description of changes:

This PR pre-emptively assumes we want to go towards being compatible with the spec and switch the go implementation over time. So it takes the first safe step towards that.

For the service definition

package simple;
service hello {
    rpc world(msg) returns(msg);
}

Go server now accepts both cases of method name to ensure compatibility with older go clients:

  1. /twirp/simple.Hello/world
  2. /twirp/simple.Hello/World

Go client sends requests to /twirp/simple.Hello/world.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ofpiyush ofpiyush closed this Jul 3, 2020
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.

1 participant