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

[Go] Adding enum support #5635

Merged
merged 2 commits into from
May 15, 2017
Merged

[Go] Adding enum support #5635

merged 2 commits into from
May 15, 2017

Conversation

marcusljx
Copy link
Contributor

@marcusljx marcusljx commented May 13, 2017

PR checklist

  • Read the contribution guidelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

Fixes #4459
Adding enum generation support for golang. After some investigation, it turns out the missing key to actually getting the enum value support for the mustache fields was to call postProcessModelsEnum() before returning the objs result in the client-generator's postProcessModels() function.

Derived from #5631.
@wing328
@antihax

@wing328
Copy link
Contributor

wing328 commented May 14, 2017

@marcusljx thanks for the PR to support outer enum.

@marcusljx
Copy link
Contributor Author

@wing328 will this PR be merged soon?

@wing328 wing328 merged commit 2b56384 into swagger-api:2.3.0 May 15, 2017
@wing328
Copy link
Contributor

wing328 commented May 15, 2017

@marcusljx PR merged. Thanks for the contribution.

There are 2 enhancements I can think of:

  1. add support for inner enum (not enum class)
  2. add test cases to ensure the enum (constant) works as expected.

I'll create an issue to track these.

@wing328
Copy link
Contributor

wing328 commented May 15, 2017

FYI. Created #5641 for tracking.

@wing328 wing328 changed the title Adding enum generation support for golang client [Go] Adding enum support May 17, 2017
maros7 pushed a commit to maros7/grpc-gateway that referenced this pull request Aug 28, 2018
Added pathenum proto for an externally imported enum example and verification
Added enum_helper.go to handle the lack of enum support in the swagger-codegen-cli 2.2.2 for Go, see swagger-api/swagger-codegen#5635
maros7 pushed a commit to maros7/grpc-gateway that referenced this pull request Aug 28, 2018
Updated protoc-gen-grpc-gateway to handle enum path parameters

Regenerated examples
Added pathenum proto for an externally imported enum example and verification
Added enum_helper.go to handle the lack of enum support in the swagger-codegen-cli 2.2.2 for Go, see swagger-api/swagger-codegen#5635

Fixed browser integration test cases

Updated bazel config

Fixed last, faulty bazel config
maros7 pushed a commit to maros7/grpc-gateway that referenced this pull request Aug 28, 2018
Related to grpc-ecosystem#322

Updated protoc-gen-swagger to output enum path parameters correctly

Updated protoc-gen-grpc-gateway to handle enum path parameters

Regenerated examples

Added pathenum proto for an externally imported enum example and verification

Added enum_helper.go to handle the lack of enum support in the swagger-codegen-cli 2.2.2 for Go, see swagger-api/swagger-codegen#5635

Fixed browser integration test cases

Updated bazel config

Fixed last, faulty bazel config

Updated integration test case to test both index == 0 and index > 0 for enums
johanbrandhorst pushed a commit to grpc-ecosystem/grpc-gateway that referenced this pull request Aug 29, 2018
Related to #322

Updated protoc-gen-swagger to output enum path parameters correctly

Updated protoc-gen-grpc-gateway to handle enum path parameters

Regenerated examples

Added pathenum proto for an externally imported enum example and verification

Added enum_helper.go to handle the lack of enum support in the swagger-codegen-cli 2.2.2 for Go, see swagger-api/swagger-codegen#5635

Fixed browser integration test cases

Updated bazel config

Fixed last, faulty bazel config

Updated integration test case to test both index == 0 and index > 0 for enums
adasari pushed a commit to adasari/grpc-gateway that referenced this pull request Apr 9, 2020
Related to grpc-ecosystem#322

Updated protoc-gen-swagger to output enum path parameters correctly

Updated protoc-gen-grpc-gateway to handle enum path parameters

Regenerated examples

Added pathenum proto for an externally imported enum example and verification

Added enum_helper.go to handle the lack of enum support in the swagger-codegen-cli 2.2.2 for Go, see swagger-api/swagger-codegen#5635

Fixed browser integration test cases

Updated bazel config

Fixed last, faulty bazel config

Updated integration test case to test both index == 0 and index > 0 for enums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants