Skip to content

Conversation

@bilak
Copy link
Contributor

@bilak bilak commented Mar 10, 2019

fixes #2195

@bilak bilak changed the title [2195] added missing getter for enum value [JAVA][SPRING][2195] added missing getter for enum value Mar 10, 2019
@wing328
Copy link
Member

wing328 commented Mar 12, 2019

@bilak please update the samples so that the CIs can test the change. Let me know if you need help on that.

cc @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)

@bilak
Copy link
Contributor Author

bilak commented Mar 12, 2019

@wing328 yes please guid me through update. Lastly when I did it, it failed on some parts.

@wing328
Copy link
Member

wing328 commented Mar 12, 2019

@bilak can you leave me a message via https://gitter.im so that I can share the steps with you?

@bilak bilak force-pushed the bugfix/2195_added-missing-getter-for-enum-value branch from 009f2a0 to 3e685f1 Compare March 27, 2019 14:55
@bilak
Copy link
Contributor Author

bilak commented Mar 27, 2019

@wing328 what is wrong here please? Do I need to regenerate something? I've just rebased on master.

@bilak
Copy link
Contributor Author

bilak commented May 16, 2019

@wing328 can this get to 4.x please?

@wing328
Copy link
Member

wing328 commented May 30, 2019

I restart the CircleCI job. Let's see if all the tests pass.

@bilak bilak force-pushed the bugfix/2195_added-missing-getter-for-enum-value branch from 3e685f1 to 3eeb9c1 Compare September 5, 2019 18:16
@bilak bilak force-pushed the bugfix/2195_added-missing-getter-for-enum-value branch from 3eeb9c1 to 3526147 Compare September 6, 2019 06:38
@bilak
Copy link
Contributor Author

bilak commented Sep 6, 2019

@wing328 waht's wrong here? I've executed ./bin/spring-all-petstore.sh but it looks like there is another configuration.

@macjohnny macjohnny requested a review from cbornet September 10, 2019 07:04
@macjohnny macjohnny added this to the 4.1.2 milestone Sep 10, 2019
@macjohnny
Copy link
Member

@bilak there are some problems with your PR. Please have a look at the result of the CI: https://circleci.com/gh/OpenAPITools/openapi-generator/8868?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

@bilak
Copy link
Contributor Author

bilak commented Sep 10, 2019

@macjohnny can you help me with those? I don't understand what's wrong there. Could not write request: no suitable HttpMessageConverter found for request type [org.openapitools.model.Pet] and content type [application/json]

@macjohnny
Copy link
Member

I think this is the relevant message:

2019-09-10 07:17:49.237  WARN 15046 --- [nAPIPetstore-10] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson serialization for type [class org.openapitools.model.Order]: com.fasterxml.jackson.databind.JsonMappingException: Problem with definition of [AnnotedClass org.openapitools.model.Order$StatusEnum]: Multiple 'as-value' properties defined ([method org.openapitools.model.Order$StatusEnum#toString(0 params)] vs [method org.openapitools.model.Order$StatusEnum#getValue(0 params)])
2019-09-10 07:17:49.243  WARN 15046 --- [nAPIPetstore-10] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson serialization for type [class org.openapitools.model.Order]: com.fasterxml.jackson.databind.JsonMappingException: Problem with definition of [AnnotedClass org.openapitools.model.Order$StatusEnum]: Multiple 'as-value' properties defined ([method org.openapitools.model.Order$StatusEnum#toString(0 params)] vs [method org.openapitools.model.Order$StatusEnum#getValue(0 params)])
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.119 s <<< FAILURE! - in org.openapitools.api.StoreApiTest

@bilak
Copy link
Contributor Author

bilak commented Sep 10, 2019

@macjohnny well I don't understand what's wrong there. The parameter of enum is String so the getValue is correct and returns string. Don't understand why jackson complains about those methods.

@macjohnny
Copy link
Member

macjohnny commented Sep 10, 2019

it is because there are two @JsonValue annotated methods of the enum:

@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

I think similar to

{{#jackson}}
@JsonValue
{{/jackson}}
public {{{dataType}}} getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}

it the @JsonValue annotation should be removed from the toString() method.

see also https://www.baeldung.com/jackson-serialize-enums

@jmini do you agree?

@bilak
Copy link
Contributor Author

bilak commented Sep 10, 2019

@macjohnny does the last bug has something common with spring? I see problem in okhttp-gson

@macjohnny
Copy link
Member

all tests in the CI pass, so we should wait for a review by the technical committee

@wing328 wing328 removed this from the 4.1.2 milestone Sep 11, 2019
@wing328 wing328 added this to the 4.1.3 milestone Sep 11, 2019
@wing328 wing328 modified the milestones: 4.1.3, 4.2.0 Oct 4, 2019
@wing328 wing328 removed this from the 4.2.0 milestone Oct 30, 2019
@wing328 wing328 merged commit f37d26c into OpenAPITools:master Dec 29, 2019
@wing328 wing328 added this to the 4.2.3 milestone Dec 29, 2019
wing328 added a commit that referenced this pull request Jan 2, 2020
* Fix for Issue #2205

Because when we have tags on OpenAPI Specification, there can be more than 1 Feign Beans being generated and the title field is share by all the clients. This makes the code to stop working in runtime.
Here is a PR which uses the classVarName instead, which follows the standards and should be enough to solve this issue.

For more info please refer to: #2205

* fix java feign parameter request name (#4883)

* update sprign cloud feign sample

* [JAVA][SPRING][2195] added missing getter for enum value (#2346)

* [2195] added missing getter for enum value

* updated samples

* re-generate spring samples

* Removed @jsonvalue from toString and regenerated samples

* re-generate spring samples

Co-authored-by: Esteban Gehring <[email protected]>

* update samples

* [kotlin][client] make Request date converter toJson as default

* [kotlin][client] update windows scripts

* [kotlin][client] update docs

* [kotlin][client] update scripts

* [kotlin][client] update scripts

Co-authored-by: Filipe Manuel Couto Pinheiro <[email protected]>
Co-authored-by: William Cheng <[email protected]>
Co-authored-by: Lukáš Vasek <[email protected]>
Co-authored-by: Esteban Gehring <[email protected]>
@wing328 wing328 changed the title [JAVA][SPRING][2195] added missing getter for enum value [JAVA][SPRING]added missing getter for enum value Jan 31, 2020
@wing328 wing328 changed the title [JAVA][SPRING]added missing getter for enum value [JAVA][SPRING] added missing getter for enum value Jan 31, 2020
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.

[BUG][JAVA-Spring] Enum without value getter

3 participants