You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code generated by Kiota for a given API generated several classes that inherit from the ApiException.
I've tried to simulate a situation on which one of those, as a result of a response of the server, would be thrown. However, it doesn't throw the specific one but instead, the generic ApiException:
Note that the ResponseStatusCode is not 400 as the generated class suggest but instead 422.
I've looked at the error type map docs, and it appear to me that the exception is not being properly mapped correctly because of this.
The Swagger file doesn't explicitly say about the 422 response code, but their docs say it can be returned.
I know I could ask the API provider to fix their API spec. However, there are some cases where this is just not that feasible as they, in my case, are huge banks, it would take a while to get a reply.
So my question is: Is there a way for us, Kiota consumers, to somehow customize the API being generated using the CLI or something else?
Again, I know this is the API provider fault, but I'm pretty sure a lot of people will find out crappy API specs out there which they would like to "tweak" the generator in order to get the desired result.
Side note: When generating this API client, we've got this:
kiota generate -l CSharp -n "TP.Payments.Acquirers.Rede" \
-c RedeApiClient -d https://developer.userede.com.br/dev-portal-swaggers/erede/swagger.json -o $PWD/ApiClient
warn: Kiota.Builder.KiotaBuilder[0]
OpenAPI warning: #/ - Multiple servers entries were found in the OpenAPI description. Only the first one will be used. The root URL can be set manually with the request adapter.
warn: Kiota.Builder.KiotaBuilder[0]
OpenAPI warning: #/ - The schema /v1/transactions is a polymorphic type but does not define a discriminator. This will result in a serialization errors.
Generation completed successfully
I'm not 100% sure where the problem lies tbh...
Thanks! Keep the great work!
The text was updated successfully, but these errors were encountered:
Hi @galvesribeiro
Thanks for using kiota and for reaching out.
However, there are some cases where this is just not that feasible as they, in my case, are huge banks, it would take a while to get a reply.
Being a bank and/or slow is not an excuse for the description being inaccurate. Contact them anyway, when they eventually fix it, it'll benefit every other developer out there, improving their integration story and leading to more business for them. (lead with that aspect, banks generally care about making money)
Is there a way for us, Kiota consumers, to somehow customize the API being generated
Besides the arguments offered by the CLI, no. There are two main reasons for that:
We want to keep kiota as simple as possible, too many options lead to confusion and maintenance hell.
We want people to report description issues so they get addressed, leading to a better state of the ecosystem.
In the interim, make a local copy of their description, and make a couple of modifications to address the short comings. This can be used as a test bed for any feedback you provide them as well.
Yeah, I agree that is not an excuse. Just saying that they will take months to report back with an update and meanwhile we wouldn't be able to use Kiota and have to write the client ourselves.
I tried modifying their swagger.json and add the 422 response with the same exception type and it essentially worked.
Hello guys!
The code generated by Kiota for a given API generated several classes that inherit from the
ApiException
.I've tried to simulate a situation on which one of those, as a result of a response of the server, would be thrown. However, it doesn't throw the specific one but instead, the generic
ApiException
:Note that the
ResponseStatusCode
is not 400 as the generated class suggest but instead 422.I've looked at the error type map docs, and it appear to me that the exception is not being properly mapped correctly because of this.
The Swagger file doesn't explicitly say about the 422 response code, but their docs say it can be returned.
I know I could ask the API provider to fix their API spec. However, there are some cases where this is just not that feasible as they, in my case, are huge banks, it would take a while to get a reply.
So my question is: Is there a way for us, Kiota consumers, to somehow customize the API being generated using the CLI or something else?
Again, I know this is the API provider fault, but I'm pretty sure a lot of people will find out crappy API specs out there which they would like to "tweak" the generator in order to get the desired result.
Side note: When generating this API client, we've got this:
I'm not 100% sure where the problem lies tbh...
Thanks! Keep the great work!
The text was updated successfully, but these errors were encountered: