fix: report missing import properly in loadSync#1960
Merged
alexander-fenster merged 1 commit intomasterfrom Jan 16, 2024
Merged
fix: report missing import properly in loadSync#1960alexander-fenster merged 1 commit intomasterfrom
alexander-fenster merged 1 commit intomasterfrom
Conversation
bcoe
approved these changes
Jan 15, 2024
bcoe
left a comment
There was a problem hiding this comment.
I'm a little confused, is callback called elsewhere when using loadSync, rather than line 105?
| callback = null; | ||
| if (sync) | ||
| throw err; | ||
| var cb = callback; |
There was a problem hiding this comment.
The style is internally consistent, so LGTM. But, it would be an improvement to use let / const to protect us from weird scope issues.
Contributor
Author
Only in line 105, but |
Merged
This was referenced Feb 9, 2024
vchudnov-g
added a commit
to googleapis/disco-to-proto3-converter
that referenced
this pull request
Jul 31, 2024
This commit restores proto imports in the intended order, undoing the workaround in #108 due to protobufjs/protobuf.js#1954 now that the solution protobufjs/protobuf.js#1960 is implemented.
This was referenced Sep 10, 2024
vchudnov-g
added a commit
to googleapis/disco-to-proto3-converter
that referenced
this pull request
Oct 10, 2024
…,ListValue,Struct} (#131) The converter will now recognize a `format` specifier in certain schemas. Specifically, the following combinations are now recognized and result in a protobuf field whose type is the specified `format`: | Discovery `"type"` | Discovery `"format"` | |--------------------|-----------------------------| | `object` | `google.protobuf.Struct` | | `any` | `google.protobuf.Value` | | `array` | `google.protobuf.ListValue` | Note that, as was the case previously, other schemas with `"type" = "any"` and any other `format`, including none, are not accepted unless they are in an `error.details` field. (Googlers, see also cl/683528084.) Incidentally, this PR also restores proto imports in the intended order, undoing the workaround in #108 due to protobufjs/protobuf.js#1954 now that the solution protobufjs/protobuf.js#1960 is implemented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1954.
The
finishfunction can be called in two modes, sync (when it throws an exception), or async (when it calls the callback). It makes sure the callback won't be called twice, but it makes one extra step and clean up the callback even it was called in sync mode. It causes problems such as in #1954 where instead of reporting "file not found" when parsing a proto, it jumps over that error and only reports the next error–or no error if the parsing happens to succeed without a bunch of imports being skipped as a result of the first exception.Let's avoid clearing the callback if we haven't used it yet.
The problem actually occurs when loading a proto file in sync mode (e.g. by running
root.loadSync(filename), which is whatpbjsdoes), hence the PR title.