Hi Arlan,
I agree, I believe it would work changing the API definition to use either 
array or list.
Unfortunately the API has already been defined, we agreed on it "soundness" 
and it have been already implemented in a server and another client, so I'm 
reluctant to the idea of changing the API because of a technical limitation.
This is the reason I'm looking for a proper fix instead of a workaround.

Thanks,
Alessandro

Il giorno sabato 29 settembre 2018 14:40:20 UTC+2, Arlan Galvez ha scritto:
>
> Hi, did you try to transform dictionaries to another more basic structure? 
> I think it would work with an array or a list.
>
>
> El viernes, 28 de septiembre de 2018, 6:03:54 (UTC-4), Alessandro 
> Petrozzelli escribió:
>>
>> Hi all, I'm looking for a little bit (I hope) of help about swagger2 API 
>> client generation through swagger-codegen.
>> Following is a snippet of the input parameter for my API:
>>
>> "DeviceAuthrorizationRequestVM": {
>> "type": "object",
>> "required": ["client_id",
>> "user_code"],
>> "properties": {
>> "client_id": {
>> "type": "string"
>> },
>> "device_info": {
>> "type": "object",
>> "additionalProperties": {
>> "type": "string"
>> }
>> },
>> "user_code": {
>> "type": "string"
>> }
>> },
>> "title": "DeviceAuthrorizationRequestVM"
>> },
>>
>> The Java client code generated by swagger-codegen works perfectly fine 
>> whereas the qt5cpp (c++) client have troubles.
>> It looks like the reason is the different way of handling the 
>> "device_info" part, here is an actual example of how the Java and C++ code 
>> invoke the service:
>>
>> Java: 
>> {"client_id":"clientId","device_info":{"JVMVersion":"25.171-b11"},"user_code":"705364"}
>> C++: {"client_id":"clientId","device_info":[{"key": "value"}]        
>>  ,"user_code":"727693"}
>>
>> Looking at the specs (
>> https://swagger.io/docs/specification/data-models/dictionaries/) I 
>> understand the Java way is the correct one as it is a JSON representation 
>> for a dictionary while 
>> the C++ one is an array of objects.
>> Am I correct? Did anyone have to deal with such problem?
>>
>> Assuming this is in fact a bug, I think the better way of dealing with 
>> this problem would be to contribute to the project providing a fix for it.
>> Anyone willing to guide me through the process?
>> Investigating a bit I found out that swagger-codegen 3 changed the 
>> template engine from mustache to handlebar: does it means that 
>> swagger-codegen 2.x will be phased-out soon?
>> Is it worth investing into it then? (I would say yes in this specific 
>> case)
>> Another option I have is to provide my own template for it to handle my 
>> specific case.
>>
>> What's your thought on this?
>>
>> Thanks in advance,
>> Alessandro Petrozzelli
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to