-
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
Add flag 'allow_repeated_fields_in_body' to protoc-gen-swagger #853
Add flag 'allow_repeated_fields_in_body' to protoc-gen-swagger #853
Conversation
Also added/updated tests for flags
Codecov Report
@@ Coverage Diff @@
## master #853 +/- ##
==========================================
- Coverage 51.83% 51.66% -0.17%
==========================================
Files 39 39
Lines 3764 3782 +18
==========================================
+ Hits 1951 1954 +3
- Misses 1629 1643 +14
- Partials 184 185 +1
Continue to review full report at Codecov.
|
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.
Thanks for this, but I'm a little confused, this doesn't seem to change the output of the swagger file. I don't know if this accomplishes anything at the moment? If it does change behaviour, could you add an example of how to make use of this new functionality to a_little_bit_of_everything.proto
in examples/proto?
I asked that question in the slack room, this change does change the output of the swagger file, but it requires a CLI parameter in order to trigger the change, and I was having trouble getting the bazel part to run with the added flag required. I can go back and check to see what bazel stuff I need to change in order to pass in the flag, but I'm unfamiliar with bazel, and it might take a bit. |
I see.. could you add a new file (e.g. the snippet in your PR) that we can generate with the relevant CLI flag and add it to the Makefile? |
Ignore Bazel, I don't know if it's relevant in this case, the generation all goes through the Makefile AFAIK. |
Well, it's less bazel, and more the circle step of running bazel... I had updated the response_body_service.proto to include a sample since it was related, but ran into problems... I'll add a new proto that just requires that flag. |
What was the problems with that proto if I might ask? I hope the generation step is easy enough? A lot of effort has gone into making this process simpler so let me know if there's anything we can improve. |
Well, my first attempt was to just change the circleci config to add the GATEWAY_PLUGIN_FLAGS=allow_repeated_fields_in_body=true SWAGGER_PLUGIN_FLAGS=allow_repeated_fields_in_body=true make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}" # Set in Docker image and then generated everything like it says in the contributing.md but when I ran the bazel job locally using
Maybe I missed that it was looking at the BUILD.bazel file in the examplepb folder. But I dont' know where I would add the extra flag in that file. |
I can't help with that error I'm afraid (@achew22?) but perhaps it will be easier to add a new file 😅. |
I think adding a new option to the compiler is the way to go.
Becomes
|
Awesome, thanks! I'll add that and see where I get |
Also: * Added integration tests * Added an extra cli test for parsing the flag
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.
Perfect, this makes sense now!
* protoc-gen-swagger: add flag 'allow_repeated_fields_in_body' Also added/updated tests for flags * protoc-gen-swagger: updated response body example Also: * Added integration tests * Added an extra cli test for parsing the flag
PR #712 provided support for repeated fields in the body of a response to protoc-gen-gateway, but failed to add it to protoc-gen-swagger.
I simply copied the flag over and updated the registry, and it handles the swagger generation for the same scenario.