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

v2 release planning #1223

Closed
13 tasks done
johanbrandhorst opened this issue Apr 20, 2020 · 36 comments · Fixed by #1731
Closed
13 tasks done

v2 release planning #1223

johanbrandhorst opened this issue Apr 20, 2020 · 36 comments · Fixed by #1731
Milestone

Comments

@johanbrandhorst
Copy link
Collaborator

johanbrandhorst commented Apr 20, 2020

I figured we should have an issue to track the outstanding work for tagging a first stable v2 version of the gateway and switching the default branches. I've looked through the issue tracker and I think these are some of the issues we want to tackle:

I will update this issue as we find more things we want to have in a v2 release. I've also updated the v2 milestone: https://github.com/grpc-ecosystem/grpc-gateway/milestone/3.

@johanbrandhorst johanbrandhorst added this to the 2.0 milestone Apr 20, 2020
@johanbrandhorst
Copy link
Collaborator Author

Another one: rename swagger to openapi everywhere (why not).

@johanbrandhorst
Copy link
Collaborator Author

Minimal public API is in #1249

@johanbrandhorst
Copy link
Collaborator Author

Consolidating error handling configuration is here: #1265

@johanbrandhorst
Copy link
Collaborator Author

@jhump Note that WithStreamErrorHandler was recently removed in an attempt to simplify the error configuration API. I think this was a contribution of yours, so I'm interested in hearing your use case, so that we can still support that. If we have to, we can add back the StreamErrorHandler, but I'd ideally like it to be as free-form as the unary error handler. What do you think?

@jhump
Copy link
Contributor

jhump commented May 4, 2020

Is the unary error handler signature changing, too?

With a server stream, if the failure is mid-stream (e.g. response status and headers already sent), the unary signature does not suffice -- you can't really set an error status or headers at that point. So the error must be translated into some sort of final error message on the stream.

Also, the swagger definition refers to an error structure in its representation of an element in the stream, since it can either have data or an error. And it seems like the stream error handler must produce something with that shape in order for swagger-generated stuff to be able to process the message.

@johanbrandhorst
Copy link
Collaborator Author

johanbrandhorst commented May 4, 2020

Is the unary error handler signature changing, too?

The unary error handler has the same signature, but it crucially gives complete power to the user to specify how to write errors to the response body. It is currently under review: #1265.

With a server stream, if the failure is mid-stream (e.g. response status and headers already sent), the unary signature does not suffice -- you can't really set an error status or headers at that point. So the error must be translated into some sort of final error message on the stream.

Also, the swagger definition refers to an error structure in its representation of an element in the stream, since it can either have data or an error. And it seems like the stream error handler must produce something with that shape in order for swagger-generated stuff to be able to process the message.

The issue I had with the existing stream handler was that it did not give enough power to the user to justify having the API (I'd gladly change my mind on this, which is why I'm asking for feedback). It was only letting you change a few variables. Ideally we'd understand the use cases here so we can support that by default, or give the user full control over how to write the error, like we do for the unary error handler (perhaps unify them somehow).

The point that the swagger signature wouldn't match is already true for the unary case, and it's possible to override the return type with swagger annotations and turn off the generation of the default error return in the swagger generator so that they match up in the case of a custom error handler. Ideally we'd be able to support that in the streaming case, too, within the defined stream envelope.

What do you think?

@jhump
Copy link
Contributor

jhump commented May 4, 2020

The issue I had with the existing stream handler was that it did not give enough power to the user to justify having the API (I'd gladly change my mind on this, which is why I'm asking for feedback). It was only letting you change a few variables. Ideally we'd understand the use cases here so we can support that by default, or give the user full control over how to write the error, like we do for the unary error handler (perhaps unify them somehow).

This sounds great to me. What I contributed had the shape it did so that it was (a) compatible with the existing APIs in the package and (b) compatible with ancillary things, like the swagger representation.

With brand new APIs, my hope would be that there is a way to customize errors that we can easily write them to the body in the case of a stream error, where a status code and headers have already been sent. Also, it would be nice to be able to emit a swagger spec that accurately describes the error format. So as long as a solution has those properties, I do not have a strong opinion. I am certainly not wed to the way this worked before. I'll admit it was a bit of a hack, but was adequate at the time (and still is today -- we mainly wanted to omit certain properties from the error response and to be able to do other kinds of filtering, and didn't need to make any significant changes to the response format).

Anyhow, I left a couple of comments on the PR you linked above. Hopefully they make sense. And thanks for pinging me to get my input! I do appreciate it.

@johanbrandhorst
Copy link
Collaborator Author

This is probably going to be blocked on googleapis/google-cloud-go#1815 as we will rely on all message types implementing the protoreflect.ProtoMessage interface, and old generated files in genproto do not.

@jhump
Copy link
Contributor

jhump commented May 12, 2020

You can convert via protoimpl.X.MessageOf(msgV1). This returns the same things as the ProtoReflect() method would on a newer generated message.

@johanbrandhorst
Copy link
Collaborator Author

I considered it, and even started implementing it, but I think unless it becomes a requirement that we support both new and old it's not something worth adding (unless it becomes clear that it will take a long time for this to happen upstream).

Sidenote; that package explicitly exists outside their compatibility promise: https://github.com/protocolbuffers/protobuf-go/blob/master/runtime/protoimpl/impl.go#L8-L12, did you mean to link https://pkg.go.dev/github.com/golang/protobuf/proto?tab=doc#MessageV2?

@jhump
Copy link
Contributor

jhump commented May 12, 2020

did you mean to link https://pkg.go.dev/github.com/golang/protobuf/proto?tab=doc#MessageV2?

Indeed! I was looking for this entry point in the wrong branch, so found the caveat-unsupported one instead of the right one.

@srenatus
Copy link
Contributor

srenatus commented May 14, 2020

❓ Can we add something like: you can configure unmarshaling per-method, or per-content-type?

My needs has been resolved:

Ayush Gupta: @srenatus WithMarshaler is a misnomer, you can define a Unmashalller by embedding the default marshaler in it

@johanbrandhorst
Copy link
Collaborator Author

As discussed in #1335, it would be nice to make configuring an unmarshaler easier, but it's not entirely clear to me how to do that.

@johanbrandhorst
Copy link
Collaborator Author

#1358 removes all uses of the github.com/golang/protobuf/proto and github.com/golang/protobuf/jsonpb packages.

@johanbrandhorst
Copy link
Collaborator Author

Change to UseProtoNames: false in default marshaler is #1376

@johanbrandhorst
Copy link
Collaborator Author

Default values in default marshaler is #1377

@johanbrandhorst
Copy link
Collaborator Author

Last match wins behaviour is in #1384

@johanbrandhorst
Copy link
Collaborator Author

Removing DisallowUnknownFields is in #1386

@johanbrandhorst
Copy link
Collaborator Author

Swagger renaming is in #1390

@johanbrandhorst
Copy link
Collaborator Author

This concludes all of the changes we wanted to make for v2, as far as I know.

Because I would like to move the gateway entirely off the old stack, we are now waiting on grpc/grpc-go#3453 and, by extension, an update to rules_go to remove dependencies on old well known type packages. After those features are available, we should be able to consider tagging a stable v2 release.

@Goobs
Copy link

Goobs commented May 28, 2020

Hi, are you going to include #1278 in v2 release? There is a label "V2" on that issue, but it doesn't present in check-list above. Thanks.

@johanbrandhorst
Copy link
Collaborator Author

@Goobs it's something we can add support for after making the first stable release of the gateway, so it's not part of this planning.

@johanbrandhorst
Copy link
Collaborator Author

#1419 switches us to protoc-gen-go-grpc

@johanbrandhorst
Copy link
Collaborator Author

We'll have to wait for a stable release of protoc-gen-go-grpc, but we're getting much closer.

@slimsag
Copy link

slimsag commented Jul 12, 2020

Have you considered marking the v2 branch as the primary branch on GitHub? I almost started work on a large docs PR before I saw this issue :)

Or, if opposed to that, maybe calling it out in the v1 README perhaps?

@johanbrandhorst
Copy link
Collaborator Author

We're going to merge v2 into master once we have a stable release of protoc-gen-go-grpc. Sorry for the confusion!

@mvrhov
Copy link

mvrhov commented Aug 31, 2020

The protoc-gen-go-grpc are saying they still don't have timeline for v1 of their tool does this mean that this has stalled indefinitely?
P.S. I find optional annotation very important.

@achew22
Copy link
Collaborator

achew22 commented Aug 31, 2020

It simply means we are on the same release schedule as them. You can always depend upon this branch of the code before it is 2.0. We are not going to release our 2.0 unless the API we are upgrading to internally is stable.

@johanbrandhorst
Copy link
Collaborator Author

The protoc-gen-go-grpc are saying they still don't have timeline for v1 of their tool does this mean that this has stalled indefinitely?
P.S. I find optional annotation very important.

FYI I think we can expect a 1.0 tag for protoc-gen-go-grpc soonish, AFAIK it was mostly blocked on grpc/grpc-go#3669, which now has a candidate implementation.

@mvrhov
Copy link

mvrhov commented Sep 1, 2020

Can you then implement the support for new experimental optional parameter, if there is anything to implement... The generators mostly just had to say that they support it... Thanks

@achew22
Copy link
Collaborator

achew22 commented Sep 1, 2020

@mvrhov, the pull request button is at the top of the page. I'm really looking forward to engaging more in the code you submit to enhance the project.

Thanks!

@johanbrandhorst
Copy link
Collaborator Author

https://github.com/grpc/grpc-go/releases/tag/cmd/protoc-gen-go-grpc/v1.0.0 has just been tagged so potentially that's the last hurdle for us tagging v2. My plan for the release is as follows:

  1. Pin to protoc-gen-go-grpc 1.0.0 in v2 and make sure everything still works.
  2. Create a final v1 release before creating the v1 release branch
  3. Create v1 release branch
  4. Merge v2 into master. This PR will also have to update all the v2 specific branch links.
  5. Create first stable v2 release from master.

Any thoughts on this plan @achew22 @tmc?

@achew22
Copy link
Collaborator

achew22 commented Oct 3, 2020

I think you've got it right. Thanks Johan

@ivucica
Copy link
Collaborator

ivucica commented Oct 3, 2020

Merge v2 into master

@johanbrandhorst This may break GOPATH users like me. (Obligatory xkcd)

Would just making v2 branch the new 'default branch' work better?

@johanbrandhorst
Copy link
Collaborator Author

Merge v2 into master

@johanbrandhorst This may break GOPATH users like me. (Obligatory xkcd)

Would just making v2 branch the new 'default branch' work better?

To answer this question in public; this isn't a realistic option for us, unfortunately. So yes, the v2 release will break GOPATH users. Please migrate to modules or stay on v1.

@johanbrandhorst
Copy link
Collaborator Author

I have tagged v1.15.1 on master and v1.15.2 on the new v1 branch.

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 a pull request may close this issue.

8 participants