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

generate multiple java files #97

Merged
merged 3 commits into from
May 2, 2024
Merged

Conversation

vroldanbet
Copy link
Contributor

@vroldanbet vroldanbet commented Mar 25, 2024

Fixes authzed/authzed-java#80

⚠️ This is a breaking change for authzed-java ⚠️

Tweaks the proto java output to have more ergonomic class names.
As a consequence, all types become top-level classes without nested outer classes.

E.g. ExperimentalServiceOuterClass.BulkImportRelationshipsResponse becomes BulkImportRelationshipsResponse

The generated output proto is less verbose, but clients will have to update their code accordingly. Given that the authzed-java SDK is < 1.0.0, we consider the API surface unstable and will proceed with the change.

From https://protobuf.dev/reference/java/java-generated/#invocation When the option java_multiple_files = true is enabled, Then the compiler will also create separate .java files for each of the classes/enums which it will generate for each top-level message, enumeration, and service declared in the .proto file.

The goal is to have this option stop generating "OuterClass" named classes for better ergonomics.

Improvements to Buf CI

The PR also changes how branches are made available. The buf GitHub Action is updated to the latest version which supports bug push --branch command. The branch will be pushed as a branch to BSR on every commit, and only as a draft when merged into main.

⚠️ API breakage linter has been temporarily disabled

Rollback 7a8b818 once these changes have been published

From https://protobuf.dev/reference/java/java-generated/#invocation
When the option java_multiple_files = true is enabled,
Then the compiler will also create separate .java files for each
of the classes/enums which it will generate for each top-level
message, enumeration, and service declared in the .proto file.

The goal is to have this option stop generating "OuterClass" named
classes for better ergonomics.
@vroldanbet vroldanbet force-pushed the java-multiple-files-option branch 4 times, most recently from 45df4f7 to f7c8b5a Compare March 25, 2024 08:53
@vroldanbet vroldanbet force-pushed the java-multiple-files-option branch 2 times, most recently from 0511c85 to db4a5c7 Compare March 25, 2024 09:18
@vroldanbet vroldanbet marked this pull request as ready for review March 25, 2024 09:25
@josephschorr
Copy link
Member

Has this change been requested?

@vroldanbet
Copy link
Contributor Author

Copy link
Member

@josephschorr josephschorr left a comment

Choose a reason for hiding this comment

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

LGTM

@vroldanbet
Copy link
Contributor Author

@jzelinskie friendly bump 🙏

@vroldanbet vroldanbet self-assigned this Apr 18, 2024
@vroldanbet vroldanbet merged commit 767f6e4 into main May 2, 2024
6 checks passed
@vroldanbet vroldanbet deleted the java-multiple-files-option branch May 2, 2024 15:18
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore "OuterClass" suffix in the generated java classes for better readability
3 participants