-
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
Swagger example field #847
Conversation
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
ok, mistake 1: I should have rebuilt the other stuff, too, of course 😅 |
Ah, yes, the CLA bot will not like the different approvers. Could you, uh, force push a new history with just your commits? |
Sure, but that'll only work if it's branched off of #799 or that other PR is merged first (and this rebased) -- which one do you prefer? 😉 |
I imagine you could just rebase on master and squash the commits so they become yours? I mean, @birdayz can be mentioned as an author in the commit still. |
OK, will do. |
use json.RawMessage for property & object examples with json.RawMessage, users can supply complete json for swagger objects (i.e. for a proto Message). If it's correct json, it will be added to the output.json and rendered correctly by consuming applications (i.e. code generators or swagger-ui) Example, in proto: option (grpc.gateway.protoc_gen_swagger.options.openapiv2_schema) = { example: { value: '{"someKey" : "someValue", "anotherKey" : 5}'; }; }; Rendered JSON: "example": { "someKey": "someValue", "anotherKey": 5 } If we used string instead of json.RawMessage, the serializer would escape the quotes and it would be serialized as a string. This is not desirable, because the output should be in fact JSON key/value pairs. Also: * a_bit_of_everything.proto: add 'example' example Co-authored-by: Johannes Brüderl <[email protected]> Signed-off-by: Stephan Renatus <[email protected]>
5a48d37
to
1e7e5ef
Compare
This makes me think that this won't fix itself, though... 🤔 Can you change the label, or should I just open another PR? |
Codecov Report
@@ Coverage Diff @@
## master #847 +/- ##
==========================================
- Coverage 50.46% 50.41% -0.06%
==========================================
Files 39 39
Lines 3761 3765 +4
==========================================
Hits 1898 1898
- Misses 1681 1685 +4
Partials 182 182
Continue to review full report at Codecov.
|
I don't have the permission to change it since I'm not a google administrator 😬. I suppose try and create a new one 😂. |
Picked up and rebased @birdayz's work on making the
example
field available.@johanbrandhorst do we have any tests that could be expanded to cover that new field?
(💭 let's see what happens in CI -- locally, the swagger.json got a bit different when running
make examples/proto/examplepb/a_bit_of_everything.swagger.json
...)