Open nvervelle opened 1 year ago
As a workaround, you can skip toUrlQueryString in POJO by disabling supportUrlQuery
, for example in CLI
--additional-properties supportUrlQuery=false
Yes, that's what I'm currently doing, that's what I meant by
if you explicitly set supportUrlQuery to false, the result builds
OK. May I know if you've time to contribute a PR to fix the issue?
Hi @wing328
Not sure I will have enough time in the following weeks (holidays soon), but if I find some time, I will look into it.
Do you have any idea were the problem might be ?
isModel
so that it has a correct value ?
Bug Report Checklist
Description
When using type mapping for some model objects to
Map
withnative
library, the generator produces a class that doesn't compile because the type mapping is not taken into account in thetoUrlQueryString()
method. While the attribute type has been correctly changed following the type mapping, the implementation oftoUrlQueryString()
doesn't take the change into account calling an non-existent method.The problem happens by default with
native
library (becausesupportUrlQuery
is set to true by default for this library), but if you explicitly setsupportUrlQuery
tofalse
, the result builds (because there's notoUrlQueryString()
method).The problem happens also for other libraries if you explicitly set
supportUrlQuery
totrue
.openapi-generator version
I saw the problem with version 6.6.0, but I reproduced the problem with master : see the sample and test reproducing the problem
OpenAPI declaration file content or url
Simple OpenAPI declaration file used by the test reproducing the problem
Generation Details
See test reproducing the problem.
Steps to reproduce
See test reproducing the problem.
The generated model file shouldn't call
getFields().toUrlQueryString()
.Related issues/PRs
Suggest a fix
The problem seems to happen because
pojo.mustache
relies on{{#isModel}}
to decide if it can use a call totoUrlQueryString()
instead of a manual encoding (Java/pojo.mustache, Java/libraries/native/pojo.mustache) but{{#isModel}}
doesn't take into account the type mapping.