Okay after adding swagger annotations as an export from my bundle. The swagger json are now including whatever I describe in the annotations. However the maven bundle plugin keeps removing my export for javax.xml.bind.annotation and so I cannot test if this also have an impact on swagger ignoring my javax.xml.bind.annotation configurations, however it does seem logical.. Digging further.
regards Nino On Tue, Dec 5, 2017 at 8:07 AM, nino martinez wael < [email protected]> wrote: > I've started testing that idea, and it seems to have an impact.. I will > return once I know more!! > > Thanks! > > On Mon, Dec 4, 2017 at 5:08 PM, Sergey Beryozkin <[email protected]> > wrote: > >> CXF Swagger feature itself is not importing Swagger annotations because >> it does not work with them, I'm not sure, may be you need to have your >> application bundle exporting the annotations to make the visible... >> >> Sergey >> On 04/12/17 15:06, nino martinez wael wrote: >> >>> No, no namespaces.... >>> >>> And I am still pussled on why it does not do it the "right" way.. >>> Currently I am experimenting putting in io.swagger.annotations BUT they >>> seem to have no effect on the generated swagger describtion when placed in >>> our backend models, they are in another bundle, im wondering if the swagger >>> feature somehow are not able to read the annotations across the bundles, >>> that would very much explain why its not working..? >>> >>> On Mon, Dec 4, 2017 at 11:46 AM, Sergey Beryozkin <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> Nice, >>> Just out of curiosity, what does Swagger set the XML Object's >>> namespace to ? Is it initialized ? >>> >>> Sergey >>> >>> On 04/12/17 06:03, nino martinez wael wrote: >>> >>> 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>...</dateForExtrac >>> t><indexNumber>...</indexNumber><accountNumber>...</ >>> accountNumber><queueNumber>...</queueNumber><personalIdentif >>> icationNumber1>...</personalIdentificationNumber1><firstName >>> 1>...</firstName1><lastName1>...</lastName1><personalIdentif >>> icationNumber2>...</personalIdentificationNumber2><firstName >>> 2>...</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</personalIdentificatio >>> nNumber1> >>> <firstName1>string</firstName1> >>> <lastName1>string</lastName1> >>> <personalIdentificationNumber2>string</personalIdentificatio >>> nNumber2> >>> <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 >>> <[email protected] >>> <mailto:[email protected]> >>> <mailto:[email protected] >>> <mailto:[email protected]>>> 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 >>> <[email protected] >>> <mailto:[email protected]> >>> <mailto:[email protected] >>> <mailto:[email protected]>>> >>> wrote: >>> >>> yup have set skip.default.json.provider.re >>> <http://skip.default.json.provider.re> >>> <http://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 >>> <[email protected] <mailto:[email protected]> >>> <mailto:[email protected] <mailto:[email protected]>>> >>> 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> >>> <http://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 < >>> [email protected] <mailto:nino.martinez.wael@gma >>> il.com> >>> <mailto:[email protected] >>> <mailto:[email protected]>>> 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 < >>> [email protected] <mailto:nino.martinez.wael@gma >>> il.com> >>> <mailto:[email protected] >>> <mailto:[email protected]>>> 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 <[email protected] >>> <mailto:[email protected]> >>> <mailto:[email protected] >>> >>> <mailto:[email protected]>>> >>> >>> 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 < >>> [email protected] <mailto:nino.martinez.wael@gma >>> il.com> >>> <mailto: >>> [email protected] >>> <mailto:[email protected]>>> >>> 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> >>> < >>> 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 < >>> [email protected] <mailto:nino.martinez.wael@gma >>> il.com> >>> <mailto: >>> [email protected] >>> >>> <mailto:[email protected]>>> >>> >>> 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 >>> >>> >>> >>> >>> -- >>> Best regards / Med venlig hilsen >>> Nino Martinez >>> >> > > > -- > Best regards / Med venlig hilsen > Nino Martinez > -- Best regards / Med venlig hilsen Nino Martinez
