Skip to content

Conversation

@rowe0x
Copy link
Contributor

@rowe0x rowe0x commented Mar 23, 2020

fix #1177

@rowe0x rowe0x closed this Mar 23, 2020
@rowe0x rowe0x reopened this Mar 23, 2020
@rowe0x rowe0x closed this Mar 23, 2020
@rowe0x rowe0x reopened this Mar 23, 2020
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these statements are very similar, maybe we could break them out into a new function instead?

rowe0x and others added 2 commits March 24, 2020 11:07
Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>
@rowe0x
Copy link
Contributor Author

rowe0x commented Mar 24, 2020

@johanbrandhorst resolved :)

@codecov-io
Copy link

codecov-io commented Mar 24, 2020

Codecov Report

Merging #1186 into master will decrease coverage by 0.08%.
The diff coverage is 34.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1186      +/-   ##
==========================================
- Coverage   54.23%   54.15%   -0.09%     
==========================================
  Files          42       42              
  Lines        4270     4297      +27     
==========================================
+ Hits         2316     2327      +11     
- Misses       1695     1712      +17     
+ Partials      259      258       -1     
Impacted Files Coverage Δ
protoc-gen-grpc-gateway/descriptor/registry.go 58.89% <0.00%> (-0.95%) ⬇️
protoc-gen-swagger/main.go 26.36% <0.00%> (-0.25%) ⬇️
protoc-gen-swagger/genswagger/template.go 56.15% <41.66%> (-0.12%) ⬇️

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 402a3ff...726582e. Read the comment docs.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, could we also just add a test for this behaviour? There should be some examples in the existing tests for how to test flags.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@johanbrandhorst johanbrandhorst merged commit 48f2e5a into grpc-ecosystem:master Mar 25, 2020
@nashikb
Copy link

nashikb commented Mar 30, 2020

@johanbrandhorst @rowe0x The enums are generated with an array of strings rather than an array of ints, which down-stream breaks swagger generators. Was this really the expected behavior?

@johanbrandhorst
Copy link
Collaborator

It's an optional flag, if it breaks your generators just don't set it. Or am I misunderstanding something?

@nashikb
Copy link

nashikb commented Mar 31, 2020

Absolutely, it's not an issue in the installed-base sense. But for the optional feature itself, I'm not sure how to use it since it's not a format supported by swagger, or at least by the "standard". I'd love to have enums as ints, and I was pleased to see this land 6 days before I wanted it :-) but the downstream support doesn't seem to be there. And if it did, it might prefer an array of int rather than an array of strings ("0", "1", etc).

@johanbrandhorst
Copy link
Collaborator

Ok, I see what you're saying. Regardless, clearly some users wanted it and here we are 🤷‍♂️.

adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
* feat: add enumAsInts flag

* Update protoc-gen-swagger/genswagger/template.go

Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>

* fix: typo

* feat: add comment

* feat: add test

Co-authored-by: Johan Brandhorst <johan.brandhorst@gmail.com>
pull bot pushed a commit to BuildingRobotics/grpc-gateway that referenced this pull request Apr 29, 2020
* feat: add enumAsInts flag

* Update protoc-gen-swagger/genswagger/template.go

Co-Authored-By: Johan Brandhorst <johan.brandhorst@gmail.com>

* fix: typo

* feat: add comment

* feat: add test

Co-authored-by: Johan Brandhorst <johan.brandhorst@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

protoc-gen-swagger: support outputting enum parameters as integers

5 participants