Skip to content

OpenAPI Vs Swashbuckle #56711

@Varorbc

Description

@Varorbc

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

public class WeatherForecast
{
    public DateOnly Date { get; set; }

    public int TemperatureC { get; set; }

    public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

    [DefaultValue("123")]
    public string? Summary { get; set; }

    public DateOnly? Date1 { get; set; }

    public int? TemperatureC1 { get; set; }

    [Required]
    public DateOnly? Date2 { get; set; }

    [Required]
    public int? TemperatureC2 { get; set; }
}

OpenAPI

image

Swashbuckle

image

@captainsafia

  • TemperatureF has no method set, and should not appear in the model
  • TemperatureC2 is a nullable attribute, but it adds a required attribute and should no longer appear nullable

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions