Skip to content

Default value for DateTime to avoid nullable  #79

@mikthemonster

Description

@mikthemonster

Im getting a lot of errors related to this issue:

/// /// Please note: This property should have been non-nullable! Since the specification file /// does not include a default value (using the "default:" property), however, the generated /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. ///

Im trying to set DefaultValues on every property in my .net Core 6 API to avoid nullable properties. It is working fine for strings, integers, boolean, but im not sure how to do it for DateTime?

I add this to my property in .net:

[DefaultValue(typeof(DateTime), "")]

I get this error in Flutter when running 'flutter pub run build_runner build --delete-conflicting-outputs' :

attribute components.schemas.GetOrderHeadersResponse.default=0001-01-01T00:00:00 is not of type date-time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions