Skip to content

[public-api] Generate Go and TS Connect protos with buf #13550

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

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Oct 3, 2022

Description

Extends buf configuration to generate Connect interfaces for Go and TS.

The generates TS is API compatible, just uses modern TS

Related Issue(s)

How to test

builds

Release Notes

NONE

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch 2 times, most recently from 406ea07 to 70888ca Compare October 4, 2022 19:28
@easyCZ easyCZ changed the base branch from main to mp/public-api-buf October 4, 2022 19:28
@roboquat roboquat added size/XL and removed size/XXL labels Oct 4, 2022
@socket-security
Copy link

socket-security bot commented Oct 4, 2022

Socket Security Report

👍 No new dependency issues detected in pull request

Socket.dev scan summary
Issue Status
Did you mean? ✅ no new possible package typos
Install scripts ✅ no new install scripts
Telemetry ✅ no new telemetry
Troll package ✅ no new troll packages
Malware ✅ no new malware
Native code ✅ no new native modules
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] [email protected]

Powered by socket.dev

@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch from 91484e0 to 40afcbf Compare October 4, 2022 19:38
@easyCZ easyCZ changed the title [public-api] Use buf for codegen [public-api] Generate Go and TS Connect protos with buf Oct 4, 2022
@roboquat roboquat added size/XXL and removed size/XL labels Oct 4, 2022
@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch 2 times, most recently from 0943e14 to de986f1 Compare October 4, 2022 19:54
@easyCZ easyCZ force-pushed the mp/public-api-buf branch 2 times, most recently from 49a714e to 6fa3d7c Compare October 5, 2022 08:04
Base automatically changed from mp/public-api-buf to main October 5, 2022 11:54
@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch 2 times, most recently from 1efb6ea to 68eb515 Compare October 5, 2022 12:14
@easyCZ easyCZ marked this pull request as ready for review October 5, 2022 12:15
@easyCZ easyCZ requested a review from a team October 5, 2022 12:15
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Oct 5, 2022
@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch from 68eb515 to 13bede9 Compare October 5, 2022 12:17
@akosyakov
Copy link
Member

@easyCZ I'm looking at generated code, and wonder how to use it? They seem to be specs of types and services.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

/hold

code-generation works, but I'm not sure how to use generated code, there is also runtime deps to gitpod-protocol. Do we need it?

@easyCZ
Copy link
Member Author

easyCZ commented Oct 6, 2022

The dependency on gitpod-protocol is due to the NPM publish scripts which live in there. I'll add an example for how to use it with a client.

@akosyakov
Copy link
Member

@easyCZ it should go to dev deps then otherwise it going to be pulled on npm install by clients

@easyCZ
Copy link
Member Author

easyCZ commented Oct 6, 2022

@akosyakov The way we use the client is here https://connect.build/docs/web/using-clients#promises

It's also implemented in the original Connect prototype here

@akosyakov
Copy link
Member

nice!

@easyCZ easyCZ force-pushed the mp/public-api-codegen-buf branch from 13bede9 to 52ae65c Compare October 6, 2022 11:48
@easyCZ
Copy link
Member Author

easyCZ commented Oct 6, 2022

@easyCZ it should go to dev deps then otherwise it going to be pulled on npm install by clients

Moved it to dev dependencies.

@akosyakov
Copy link
Member

/unhold

@roboquat roboquat merged commit bbfc28d into main Oct 6, 2022
@roboquat roboquat deleted the mp/public-api-codegen-buf branch October 6, 2022 12:18
Copy link
Member

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Looks good! I understood that we would use this API also from within node and go not only browsers, correct?
Also love this:
Screenshot 2022-10-06 at 14 17 00

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Awesome, really looking forward to actually use connect-web! 🙃

@easyCZ
Copy link
Member Author

easyCZ commented Oct 6, 2022

I understood that we would use this API also from within node and go not only browsers, correct?

Yes, we can. It doesn't remove our ability to use gRPC but we can use buf to get slightly simpler clients with less "fluff" that gRPC has. It's made more user-friendly.

@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XXL team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants