generate command yields "error generating the SDK: Object reference not set to an instance of an object"
Using kiota 0.6.0 on macos (installed via the Releases download here on GitHub):
curl -q https://gist.githubusercontent.com/DavidBiesack/cf30605f50d328aee36c9b5854859684/raw/9ca9d18ffe90128f2209a14b45f32930fdf3f2e5/banking-api-openapi-3.0.yaml > openapi.yaml
kiota generate --openapi openapi.yaml --language TypeScript --namespace-name Apiture.BankingClient --class-name BankingClient --clean-output --output ./gen/sdk/client --log-level Error
I get a cryptic error and the process fails:
crit: Kiota.Builder.KiotaBuilder[0]
error generating the SDK: Object reference not set to an instance of an object.
Thanks for the bug report. Unfortunately, the OpenAPI.NET library that does the parsing for Kiota doesn't support internal $refs to something that is not a component.
You would need to point the schema to #/components/schemas/problemResponse to resolve the issue.
I'll open an issue on https://github.com/microsoft/openapi.net to try and get a more clear error reported for that scenario.
alternatively, you can edit out the following to paths as they are the ones bringing the references the OpenAPI.net lib is not able to resolve:
- /accounts/{accountId}/transactions
- /accountBalances
Thanks @darrelmiller .
I'll adjust our tooling to simplify the $ref and keep schema references in #/components/schemas
Can kiota yield a better error message if the lib can't parse/resolve the input?
right now the parsing lib just throws a null reference exception without any additional context. Assuming the OpenAPI.net lib threw something with more information, kiota could provide more actionable feedback to the user. @darrelmiller can you take that aspect into account when you log an issue over there please?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.