Misleading error message when swagger document contains errors in $ref property
The following swagger document contains an error in a $ref property. It is missing a forward slash after the hash. Correct value should be #/components/schemas/Item
openapi: 3.0.3
info:
title: test
version: 1.0.0
paths:
/test:
get:
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#components/schemas/Item'
components:
schemas:
Item:
type: object
properties:
id:
type: integer
Using kiota to show or generate on this document..
kiota show -d "C:\test.yaml"
kiota generate -d "C:\test.yaml" -l csharp -o apiClient
...will yield a misleading error message
crit: Kiota.Builder.KiotaBuilder[0]
error generating the client: Could not find file 'C:\test.yam'.
There's no discussion the document is invalid. But you need to use another tool to find the actual error.
Strangely though, https://editor-next.swagger.io/ will successfully generate a working swaggerUI, but will correctly indicate the error in the editor. While https://apitools.dev/swagger-parser/online/# will let successfully validate the document with no errors or warnings.
Thanks for reporting this. I suspect this is an error in the OpenAPI.Net library. I'm going transfer the issue to that repo.