Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict on DateOnly when swagger file defines a DateOnly type #1186

Closed
mbursill opened this issue May 15, 2024 · 6 comments
Closed

Conflict on DateOnly when swagger file defines a DateOnly type #1186

mbursill opened this issue May 15, 2024 · 6 comments
Labels
status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Milestone

Comments

@mbursill
Copy link

Generated code for a model that includes a DateOnly type (from C#) is including the following fields:

    /**
     * The dayNumber property
     */
    dayNumber?: number;
    /**
     * The dayOfWeek property
     */
    dayOfWeek?: number;
    /**
     * The dayOfYear property
     */
    dayOfYear?: number;

However, the deserializeIntoDateOnly call is expecting a Partial<DateOnly> where the DateOnly ends up being seen as the one from the abstractions library. The abstractions version doesn't contain the above fields. This is a name conflict on the generated DateOnly type vs the class from the abstractions library.

@baywet
Copy link
Member

baywet commented May 16, 2024

Hi @mbursill
Thanks for using kiota and for reaching out.
Can you share the description/schema for that model please?

@baywet baywet added question status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels May 16, 2024
@baywet baywet added this to the Backlog milestone May 16, 2024
@mbursill
Copy link
Author

The schema:
swagger.json

It was generated from a C# API with a very simple model:

public class UpdateWidgetRequest
{
    public UpdateWidgetRequest() { }
    public string? Name { get; set; }
    public int? Size { get; set; }
    public DateOnly? InspectionDate { get; set; }
    public int? Mass { get; set; }  
}

It was tested on Kiota 1.13, 1.14 and the latest preview.

@baywet
Copy link
Member

baywet commented May 17, 2024

Thanks for the additional information. It appears the generated OAS description is not what kiota would expect here. Instead of having a component schema for DateOnly being used as the referenced schema for InspectionDate, the property should be of type string and format date.
See the OAS format registry

Maybe @captainsafia can help us here (from the ASP.net team)

@mbursill
Copy link
Author

Looks like this got a recent fix:

domaindrivendev/Swashbuckle.AspNetCore#2799

The latest 6.6.1 release of Swashbuckle.AspNetCore generates the correct OAS.

@baywet
Copy link
Member

baywet commented May 20, 2024

Thanks for the additional information. So the right code gets generated now?
Good to close?

@mbursill
Copy link
Author

Yes, all good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close
Projects
Archived in project
Development

No branches or pull requests

2 participants