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

fix: simplify handling useJsonWireFormat=true and fix onlyTypes=true #583

Merged
merged 5 commits into from
Jun 3, 2022

Conversation

oyvindwe
Copy link
Collaborator

@oyvindwe oyvindwe commented Jun 2, 2022

  • Moved logic for required and implied options into options.ts
  • Made onlyTypes=true behave as documented.

@oyvindwe oyvindwe requested a review from stephenh June 2, 2022 17:27
@oyvindwe oyvindwe changed the title Fix and simplified option handling fix: simplify handling useJsonWireFormat=true and fix onlyTypes=true Jun 2, 2022
// We should promote onlyTypes to its own documented flag, but just an alias for now
if (!options.outputJsonMethods && !options.outputEncodeMethods && !options.outputClientImpl && !options.nestJs) {
// onlyTypes=true implies outputJsonMethods=false,outputEncodeMethods=false,outputClientImpl=false,nestJs=false
if (options.onlyTypes) {
Copy link
Owner

Choose a reason for hiding this comment

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

...huh, yeah, not sure why we weren't doing this before. Great fix!

If you want to add test cases to options-test.ts to make sure these don't regress, that'd be great!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should probably have been fixed when the option was documented. :)

I'll add test cases!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tests added.

@@ -396,7 +396,7 @@ Generated code will be placed in the Gradle build directory.

- With `--ts_proto_opt=onlyTypes=true`, only types will be emitted, and imports for `long` and `protobufjs/minimal` will be excluded.

Note: _This is a combination_ of `outputJsonMethods=false,outputEncodeMethods=false,outputClientImpl=false,nestJs=false`
This is the same as setting `outputJsonMethods=false,outputEncodeMethods=false,outputClientImpl=false,nestJs=false`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if nestJs=false should be included here, as it is false by default, but nestJs=true -> onlyTypes=false.

@stephenh
Copy link
Owner

stephenh commented Jun 3, 2022

Looks great @oyvindwe , thanks!

@stephenh stephenh merged commit 6e7f938 into stephenh:main Jun 3, 2022
stephenh pushed a commit that referenced this pull request Jun 3, 2022
## [1.115.2](v1.115.1...v1.115.2) (2022-06-03)

### Bug Fixes

* simplify handling useJsonWireFormat=true and fix onlyTypes=true ([#583](#583)) ([6e7f938](6e7f938))
@stephenh
Copy link
Owner

stephenh commented Jun 3, 2022

🎉 This PR is included in version 1.115.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@oyvindwe oyvindwe deleted the fix-options branch November 7, 2023 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants