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 [email protected].
For more options, visit https://groups.google.com/d/optout.