-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
protoc_gen_swagger: Add attr for allow_merge #944
protoc_gen_swagger: Add attr for allow_merge #944
Conversation
Codecov Report
@@ Coverage Diff @@
## master #944 +/- ##
=======================================
Coverage 53.79% 53.79%
=======================================
Files 40 40
Lines 3969 3969
=======================================
Hits 2135 2135
Misses 1638 1638
Partials 196 196 Continue to review full report at Codecov.
|
Seems like a good approach, thanks for the contribution! You could create an output file called |
@drigz Thanks for that! I updated with the suggestion to use the target name. With regards to refactoring, I agree but I think it's OK for now. I'm not much of a python / starlark person so I don't fully trust my refactoring abilities in best practices :) |
LGTM, thanks! One more suggestion: if you add an invocation with |
Good idea. Thanks |
protoc-gen-swagger/defs.bzl
Outdated
@@ -99,6 +131,10 @@ protoc_gen_swagger = rule( | |||
allow_single_file = True, | |||
mandatory = False, | |||
), | |||
"allow_merge": attr.bool( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is allow_merge
the best name for this? allow_merge
makes me think that it is possible but not necessary to merge the output files. What would you think about merge_files
or single_output
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale here is that is the name of the flag provided to the protoc-gen-swagger.
I don't feel very strongly about this either way, but let me know what you think if it makes sense to match the flag name or use a more idiomatic name.
@achew22 I'd be happy to change Let me know so this doesn't rot. Thanks! |
Isn't the flag that actually does it |
You need both. merge_file_name to specify the file name and allow_merge to specify that you want to allow merging of files. That’s how I have understood and implemented the flag usage here. |
I think you're 100% right. We are exposing a new abstraction layer here, and since the user of the Bazel rule sets the name for the multiple output by setting the If you renamed it to |
@achew22 done. PTAL |
Looks good to me! Merging |
Looks like we need to update |
@achew22 just pulled in latest master, maybe that will help |
|
The only theory I have on how to fix this is to buy more CircleCI quota or to use the Bazel CI system, which I assume would handle this tidily... seeking suggestions if you have one |
@achew22 There are some helpful suggestions here about lowering bazel memory: https://github.com/bazelbuild/rules_go#how-do-i-run-bazel-on-travis-ci 4gb of memory seems like plenty. You could try adding Bazel's CI uses their own runners in buildkite and they are quite nice. :) |
Build succeeded on rerun; @achew22 I'll leave it to you to merge. |
This would output apidocs.swagger.json rather than two files of example_a.swagger.json and example_b.swagger.json.
Opening this for early review on my approach. I'll request full review soon after I've used this a bit.