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
{{ message }}
Repository navigation
Data and type mismatch found for example of a referenced schema #1526
executing: kiota generate -l csharp -d ./basic.yaml -o ./basic
with this definition:
openapi: 3.0.0
info:
title: Sample API
description: Lorem Ipsum
version: 1.0.0
servers:
- url: http://api.example.com/v1
description: Lorem Ipsum
paths:
/issues:
get:
summary: Returns a list of issues.
description: Lorem Ipsum
responses:
"200":
description: Lorem Ipsum
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: array
items:
$ref: "#/components/schemas/issueData"
example:
data:
- issuedAt: "2023-10-12"
components:
schemas:
issueData:
type: object
title: Issue Data
description: Information about the issue.
properties:
issuedAt:
type: string
format: date
description: Lorem Ipsum
example: "2023-10-12"
I get this warning:
warn: Kiota.Builder.KiotaBuilder[0]
OpenAPI warning: #/paths/~1issues/get/responses/200/content/application~1json/example/data/0/issuedAt - Data and type mismatch found.
If I dereference it, it works as expected without warnings. I know it's just a warning, but maybe a symptom of some larger issue.
Hi Andrea De Pirro (@akira28),
Thanks for using kiota and for reaching out.
I have transferred your issue in the repository this error message originates from.
More specifically, it comes from this line.
Activity
baywet commentedon Jan 12, 2024
Hi Andrea De Pirro (@akira28),
Thanks for using kiota and for reaching out.
I have transferred your issue in the repository this error message originates from.
More specifically, it comes from this line.
OpenAPI.NET/src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs
Line 223 in 4de9313
Is this something you'd be willing to look into?
baywet commentedon Jan 12, 2024
Also, before you spend any time on that, I wanted to double check you're using kiota 1.10.1
akira28 commentedon Jan 15, 2024
Vincent Biret (@baywet) I just tried with kiota 1.10.1 and get the same warning. I'll have a look at the code, let's see if I can make a PR. Thanks!
akira28 commentedon Jan 15, 2024
Vincent Biret (@baywet) I never touched any C# code, so I'm not comfortable to provide a PR.
Anyway, I think the issue lies here: https://github.com/microsoft/OpenAPI.NET/blob/4de931392d244dd6393417a92173a98ffaa594f2/src/Microsoft.OpenApi/Any/OpenApiPrimitive.cs#L121C56-L121C56
and probably this toString("o") change is not done when it's a reference? Just guessing. Also, I think it would be better to use a custom format instead of substringing it
dateValue.Value.ToString("yyyy-MM-dd");baywet commentedon Jan 15, 2024
Thanks for the additional information.
Maggie Kimani (@MaggieKimani1) can you look into that when you have a couple of minutes please?