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

Fix #2247 maps Enum constants to value of name() rather than toString() #2860

Merged
merged 2 commits into from Aug 3, 2019
Merged

Fix #2247 maps Enum constants to value of name() rather than toString() #2860

merged 2 commits into from Aug 3, 2019

Conversation

DavidSeptimus
Copy link
Contributor

This PR fixes the issue of springfox mapping Enum constants to the value of their toString() implementation by default (i.e. when no Jackson annotations are present) rather than name(). An Enum's toString() implementation can be overridden by the user in a way that makes it impossible to convert the value back to an Enum constant using Enum.valueOf() and leads to a situation where SwagggerUI cannot supply a valid parameter to an affected endpoint.

I've updated EnumSpec to reflect this change. The existing test for duplicate values is no longer relevant as name() is guaranteed to be unique per Enum constant.

This fix is related to #2247.

@codecov
Copy link

codecov bot commented Jan 12, 2019

Codecov Report

Merging #2860 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2860   +/-   ##
=========================================
  Coverage     94.43%   94.43%           
  Complexity     3226     3226           
=========================================
  Files           364      364           
  Lines          8302     8302           
  Branches        619      619           
=========================================
  Hits           7840     7840           
  Misses          304      304           
  Partials        158      158
Impacted Files Coverage Δ Complexity Δ
...ain/java/springfox/documentation/schema/Enums.java 96.42% <100%> (ø) 15 <0> (ø) ⬇️

1 similar comment
@codecov
Copy link

codecov bot commented Jan 12, 2019

Codecov Report

Merging #2860 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2860   +/-   ##
=========================================
  Coverage     94.43%   94.43%           
  Complexity     3226     3226           
=========================================
  Files           364      364           
  Lines          8302     8302           
  Branches        619      619           
=========================================
  Hits           7840     7840           
  Misses          304      304           
  Partials        158      158
Impacted Files Coverage Δ Complexity Δ
...ain/java/springfox/documentation/schema/Enums.java 96.42% <100%> (ø) 15 <0> (ø) ⬇️

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.

None yet

2 participants