Closed LucaDe closed 5 years ago
@LucaDe
Similar to #26. upgrade swagger-axios-codegen
@latest
@Manweill It's not working on v.0.7.0. Sample:
const { codegen } = require('swagger-axios-codegen')
codegen({
methodNameMode: 'operationId',
remoteUrl:'https://webhook.apaleo.com/swagger/notification-v1/swagger.json',
include: [
'Subscriptions'
],
});
I think i see what happen with it. I rebuild and publish, fix in v0.7.1.
@Manweill
Thanks for rebuilding and publishing. Still same behaviour, response type is generated and added to GET requests, but not to POST/DELETE etc.
@LucaDe It has.
static createOrUpdateEquipment(
params: {
/** */
input?: CreateOrUpdateEquipmentInput;
} = {} as any,
options: IRequestOptions = {}
): Promise<number> {
return new Promise((resolve, reject) => {
let url = '/api/services/app/Equipment/CreateOrUpdateEquipment';
const configs: IRequestConfig = getConfigs('post', 'application/json', url, options);
let data = { ...params['input'] };
configs.data = data;
axios(configs, resolve, reject);
});
}
@Manweill
Could you check with my provided sample above? It should generate the SubscriptionCreatedResponseModel and add it to subscriptionsPost(..): Promise
@Manweill I just flew over the code for response type generation. It seems that you're only providing response types for a status code of 200. In my case the API returns a 201 as Statuscode, when a new Entity is created.
I think it may be because I only deal with HttpCode 200
.
I check with your swagger JSON
. The Post
method success HttpCode
is 201
.
I think it can add HttpCode is 20X response type.
But, How to deal with Delete
method
@LucaDe Yeah, because my company's success code is only 200
I don't see why there should be a problem with DELETE methods. I will open a PR to accept 2XX status codes
OK, Welcome PR~
@LucaDe
Use yarn link
with develop
@LucaDe Published.
Currently response types are not typed (e.g. return type is always Promise< any >). It would be great to have these typed as well :)
I might look into this myself, when I find time!