From 8666e9a051e3c7b34af749c336d51f2276f5fd82 Mon Sep 17 00:00:00 2001 From: Fernando Araoz Date: Sun, 12 Jan 2025 16:09:25 -0500 Subject: [PATCH] feat: disallow null on schema --- Controllers/WeatherForecastController.cs | 6 ++++++ Program.cs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Controllers/WeatherForecastController.cs b/Controllers/WeatherForecastController.cs index fd0dc44..c409868 100644 --- a/Controllers/WeatherForecastController.cs +++ b/Controllers/WeatherForecastController.cs @@ -29,4 +29,10 @@ public class WeatherForecastController : ControllerBase }) .ToArray(); } + + [HttpPost] + public void Post(WeatherForecast forecast) + { + Console.WriteLine("Inserting!!! :D"); + } } diff --git a/Program.cs b/Program.cs index b98f6e9..42da172 100644 --- a/Program.cs +++ b/Program.cs @@ -20,7 +20,11 @@ builder.Services.AddDbContext(options => // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +builder.Services.AddSwaggerGen(options => + { + options.SupportNonNullableReferenceTypes(); + } + ); var app = builder.Build();