cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nino martinez wael <nino.martinez.w...@gmail.com>
Subject Re: CXF 3.2.1 swagger generation are wrong for json
Date Thu, 30 Nov 2017 11:17:09 GMT
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 <sberyozkin@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.wael@gmail.com> wrote:
>>
>> Im wondering if this could be the problem :
>>>
>>> https://github.com/swagger-api/swagger-core/issues/960
>>>
>>> On Thu, Nov 30, 2017 at 10:38 AM, nino martinez wael <
>>> nino.martinez.wael@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message