Okay so I've looked into this a bit. And turned the problem upside down.
Instead of trying to make the cxf swagger feature use jackson, just
taking a look at the outcome and play around trying to change it.. Again
if there is any way to see what the swagger feature plugin are using
runtime to process file with, it would very helpfull..
It seems that the swagger feature are partially ignoring my annotations,
so picking up @xmlrootelement but partially ignoring the list annotations..
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "contacts")
public class MinimalContactWrapper {
@XmlElementWrapper(name = "wrap")
@XmlElement(name = "minimalcontact")
private List<MinimalContact> contactList;
public List<MinimalContact> getMinimalContacts() {
return contactList;
}
public void setMinimalContacts(List<MinimalContact> minimalContacts) {
this.contactList = minimalContacts;
}
}
to
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name ="contacts")
public class MinimalContactWrapper {
@XmlElementRef(name ="minimalContact")
@Valid
@NotNull
@Size(min =1)
private List<MinimalContact>minimalContacts=new ArrayList<>();
public List<MinimalContact> getMinimalContacts() {
return minimalContacts;
}
public void setMinimalContacts(List<MinimalContact> minimalContacts) {
this.minimalContacts = minimalContacts;
}
}
Made the xml results required equal in the swagger feature to what CXF
and enunciate feels it should be... Namely this:
<contacts><minimalcontact><dateForExtract>...</dateForExtract><indexNumber>...</indexNumber><accountNumber>...</accountNumber><queueNumber>...</queueNumber><personalIdentificationNumber1>...</personalIdentificationNumber1><firstName1>...</firstName1><lastName1>...</lastName1><personalIdentificationNumber2>...</personalIdentificationNumber2><firstName2>...</firstName2><lastName2>...</lastName2><address>...</address><zipCode>...</zipCode><city>...</city><homePhone>...</homePhone><mobilePhone>...</mobilePhone><id>...</id><campaignId>...</campaignId></minimalcontact></contacts>
Instead of something like this:
<?xml version="1.0" encoding="UTF-8"?>
<contacts>
<minimalContacts>
<minimalcontact>
<campaignId>string</campaignId>
<id>0</id>
<indexNumber>string</indexNumber>
<accountNumber>string</accountNumber>
<queueNumber>string</queueNumber>
<balance>0</balance>
<personalIdentificationNumber1>string</personalIdentificationNumber1>
<firstName1>string</firstName1>
<lastName1>string</lastName1>
<personalIdentificationNumber2>string</personalIdentificationNumber2>
<firstName2>string</firstName2>
<lastName2>string</lastName2>
<address>string</address>
<zipCode>string</zipCode>
<city>string</city>
<homePhone>string</homePhone>
<mobilePhone>string</mobilePhone>
<dateForExtract>string</dateForExtract>
</minimalcontact>
</minimalContacts>
</contacts>
On Thu, Nov 30, 2017 at 1:43 PM, nino martinez wael
<nino.martinez.w...@gmail.com <mailto:nino.martinez.w...@gmail.com>> wrote:
No change without setting swagger2customizer..
I'll let it rest for a day..
On Thu, Nov 30, 2017 at 1:30 PM, nino martinez wael
<nino.martinez.w...@gmail.com <mailto:nino.martinez.w...@gmail.com>>
wrote:
yup have set skip.default.json.provider.re
<http://skip.default.json.provider.re>gistration..
But no matter what I do it has no effect on what the swagger
feature generates.. Where it's changing the json provider or
removing it all together..
Trying it now without setting swagger2Customizer..
On Thu, Nov 30, 2017 at 1:04 PM, Sergey Beryozkin
<sberyoz...@gmail.com <mailto:sberyoz...@gmail.com>> wrote:
Just FYI, removing Jettison lib will ensure it's not
auto-installed by CXF, and if it is not possible to remove
then the other option is to set
a "skip.default.json.provider.re
<http://skip.default.json.provider.re>gistration" bus property.
However it's not related to Swagger at all, Jettison if
installed will only affect the way JSON is generated for
service responses
Sergey
On 30/11/17 11:57, nino martinez wael wrote:
It does not seem to be a jettison problem.. And neither
an problem with
jackson versions, I just wiped all jettison and
jackson(except 2.9.1 )
versions from my running environment..
Looking into of it could be something with
JacksonJaxbJsonProvider vs
JacksonJsonProvider
On Thu, Nov 30, 2017 at 12:45 PM, nino martinez wael <
nino.martinez.w...@gmail.com
<mailto:nino.martinez.w...@gmail.com>> wrote:
IS there somewhere while on runtime where I can
print current registered
providers for cxf, I have a feeling that it somehow
are using jettison for
json...
On Thu, Nov 30, 2017 at 12:17 PM, nino martinez wael <
nino.martinez.w...@gmail.com
<mailto:nino.martinez.w...@gmail.com>> wrote:
Okay I will check into libraries whats on class
path.. I have the same
gut feeling that it could be something like that.
I have enunciate up and working on the side..
On Thu, Nov 30, 2017 at 11:18 AM, Sergey
Beryozkin <sberyoz...@gmail.com
<mailto:sberyoz...@gmail.com>>
wrote:
Yes, the minor Swagger version caused this
change, what was working
3.1.x, specifically the serializers
approach, was not working any longer
with the new Swagger version, hence this update.
I honestly do not know why exactly a JAXB
annotated bean is not
correctly represented in the
Swagger-generated #definitions, it's obviously
something to do with the way Jackson and
JAXB interacts.
Perhaps Jackson you register with DOSGI is
not the same version
installed by the CXF swagger2 feature,
perhaps some diff JAXB versions are
involved, please keep experimenting
Sergey
defaultSwagger2Serializers.setJavadocProvider(new
JavaDocProvider());
swagger.setSwagger2Serializers(defaultSwagger2Serializers);
I think this could be the same:
Swagger2Customizer swagger2Customizer =
new Swagger2Customizer();
swagger2Customizer.setJavadocProvider(new
JavaDocProvider());
swagger.setCustomizer(swagger2Customizer);
I have setup CXF to use JACKSON
(JacksonJaxbJsonProvider)
How can I tell swagger to do the same? I
think that's the problem..
regards Nino
On Thu, Nov 30, 2017 at 10:50 AM, nino
martinez wael <
nino.martinez.w...@gmail.com
<mailto:nino.martinez.w...@gmail.com>>
wrote:
Im wondering if this could be the problem :
https://github.com/swagger-api/swagger-core/issues/960
<https://github.com/swagger-api/swagger-core/issues/960>
On Thu, Nov 30, 2017 at 10:38 AM,
nino martinez wael <
nino.martinez.w...@gmail.com
<mailto:nino.martinez.w...@gmail.com>>
wrote:
So I have a bean CXF accepts only
this interpretation for my endpoint:
{
"contactList": [
{
"campaignId": "2",
"id":"",
"indexNumber": "",
"accountNumber":
"232",
"queueNumber": "0",
"balance": 0,
"personalIdentificationNumber1":
"string",
"firstName1":
"string",
"lastName1":
"string",
"personalIdentificationNumber2":
"string",
"firstName2":
"string",
"lastName2":
"string",
"address": "string",
"zipCode": "string",
"city": "string",
"homePhone": "+4521",
"mobilePhone":
"+45122",
"campaing": "string",
"dateForExtract":
"string"
}
]
}
However the swagger feature are
generating this as example:
{
"minimalContacts": [
{
"campaignId": "string",
"id": 0,
"indexNumber": "string",
"accountNumber": "string",
"queueNumber": "string",
"balance": 0,
"personalIdentificationNumber1":
"string",
"firstName1": "string",
"lastName1": "string",
"personalIdentificationNumber2":
"string",
"firstName2": "string",
"lastName2": "string",
"address": "string",
"zipCode": "string",
"city": "string",
"homePhone": "string",
"mobilePhone": "string",
"campaing": "string",
"dateForExtract": "string"
}
]
}
MinimalContactWrapper
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "contacts")
public class MinimalContactWrapper {
@XmlElementWrapper
@XmlElementRef
@Valid
@NotNull
@Size(min = 1)
private
List<MinimalContact>
contactList=new ArrayList<>();
public
List<MinimalContact>
getMinimalContacts() {
return contactList;
}
public void
setMinimalContacts(List<MinimalContact>
minimalContacts) {
this.contactList =
minimalContacts;
}
MinimalContact
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="minimalcontact")
public class MinimalContact {
@NotNull
@Size(min=1, max=240)
private String campaignId;
private Long id;
@Size(min=1, max=240)
private String indexNumber;
@Size(min=1, max=20)
@NotNull
private String accountNumber;
@Size(min=1, max=8)
private String queueNumber;
private Float balance;
@Size(min=0, max=11)
private String
personalIdentificationNumber1;
@Size(min=0, max=55)
private String firstName1;
@Size(min=0, max=55)
private String lastName1;
@Size(min=0, max=11)
private String
personalIdentificationNumber2;
private String firstName2;
private String lastName2;
private String address;
private String zipCode;
private String city;
@NotNull
@Size(min=0, max=20)
private String homePhone;
@NotNull
@Size(min=0, max=20)
private String mobilePhone;
private String campaing;
@NotNull
private String
dateForExtract;
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez
--
Best regards / Med venlig hilsen
Nino Martinez