[Swagger-codegen] Generate java client to send raw requests

37 views
Skip to first unread message

AutomationEngineer

unread,
May 12, 2016, 3:11:05 PM5/12/16
to Swagger
Hi everyone!

I'm going to use generated Java client for testing purposes. Part of the tests should verify things like what is the response from endpoint in case of requests with empty body (or broken json/xml etc). For now I don't see how I can do that, because methods in the generated API's accept specific objects (models). There is an option to use 'invokeAPI()' method from ApiClient, but in that case I need to pass path to the endpoint. That means that I need to keep paths somewhere and as result duplicate them, because I can't fetch them from methods of generated API class.
I assume that it is possible to update the template for API generation and in addition to regular methods, create methods to accept String instead of specific object. So, couple of questions here:
- can I update just one file (api.mustache), put it in directory and pass it as '-t' value? 
- is it possible to generate this additional methods only for cases of PUT/POST requests?

Please share your ideas about sending raw requests without necessity explicitly specify path and other params. Thanks in advance!

wing328

unread,
May 27, 2016, 4:41:53 AM5/27/16
to Swagger
Please open a ticket via https://github.com/swagger-api/swagger-codegen/issues if you've not done so.

William

AutomationEngineer於 2016年5月13日星期五 UTC+8上午3時11分05秒寫道:
Reply all
Reply to author
Forward
0 new messages