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(compileProtos): mention library protos before common protos #970

Merged
merged 1 commit into from
Mar 11, 2021

Conversation

alexander-fenster
Copy link
Contributor

This one is weird. The order of proto file lookup, both in protoc and in pbjs, depends on the order of folders listed in their -I / -p options (correspondingly). Apparently, in compileProtos script, we first listed the common protos from Gax, and then listed the library protos. Apparently, this does not always work.

Fails:

$ npx pbjs --target json -p ./node_modules/google-gax/protos -p protos -o protos/protos.json proto
s/google/api/servicecontrol/v1/*.proto
no such Type or Enum 'google.logging.type.LogSeverity' in Type .google.api.servicecontrol.v1.LogEntry

Works:

$ npx pbjs --target json -p protos -p ./node_modules/google-gax/protos -o protos/protos.json proto
s/google/api/servicecontrol/v1/*.proto

(the two commands differ only in the order of -p options passed)

I cannot fully explain the failure at this moment, and it might as well be a bug in pbjs, but at least I know how to workaround it by switching an order, and I believe the new order makes more sense (since we should always prioritize the proto file from the API over the common proto file).

@alexander-fenster alexander-fenster requested a review from a team as a code owner March 11, 2021 02:06
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 11, 2021
@alexander-fenster alexander-fenster changed the title Order fix(compileProtos): mention library protos before common protos Mar 11, 2021
@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #970 (9e99451) into master (bcecae1) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #970      +/-   ##
==========================================
+ Coverage   88.58%   88.69%   +0.11%     
==========================================
  Files          43       43              
  Lines        7097     7097              
  Branches      612      564      -48     
==========================================
+ Hits         6287     6295       +8     
+ Misses        800      791       -9     
- Partials       10       11       +1     
Impacted Files Coverage Δ
tools/compileProtos.ts 93.71% <100.00%> (ø)
src/fallback.ts 79.24% <0.00%> (ø)
src/normalCalls/retries.ts 98.72% <0.00%> (+5.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcecae1...9e99451. Read the comment docs.

@alexander-fenster alexander-fenster merged commit bf4c9f0 into master Mar 11, 2021
@alexander-fenster alexander-fenster deleted the order branch March 11, 2021 02:37
gcf-merge-on-green bot pushed a commit that referenced this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants