Skip to content

Bump NSwag.AspNetCore from 14.6.3 to 14.7.1#69

Merged
RiceBen merged 1 commit intomainfrom
dependabot/nuget/AspNetCoreSerilog/NSwag.AspNetCore-14.7.1
May 1, 2026
Merged

Bump NSwag.AspNetCore from 14.6.3 to 14.7.1#69
RiceBen merged 1 commit intomainfrom
dependabot/nuget/AspNetCoreSerilog/NSwag.AspNetCore-14.7.1

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github May 1, 2026

Updated NSwag.AspNetCore from 14.6.3 to 14.7.1.

Release notes

Sourced from NSwag.AspNetCore's releases.

14.7.1

[!IMPORTANT]
Upgrade directly from v14.6.3 to v14.7.1 — skip v14.7.0.

v14.7.0 bundled NJsonSchema v11.6.0, which contained a regression that silently dropped nullability on required T? / [JsonRequired] T? DTO properties. The resulting OpenAPI/JSON schema marked those properties as non-nullable, so generated TypeScript and C# clients lost null-safety for fields the server can legitimately return as null (#​5359).

Corrections to v14.7.0

v14.7.1 updates to NJsonSchema v11.6.1, which corrects the handling of the C# required keyword and [JsonRequired]:

  • These are now treated as presence markers (the property must be present in the JSON) rather than value constraints.
  • Nullability from the declared type (string?, T?) is preserved.
  • No spurious MinLength=1 on non-nullable strings.
  • DataAnnotations [Required] semantics remain unchanged (still suppresses nullability and adds MinLength=1 to strings by default, matching its runtime behavior).

Observable client changes vs v14.7.0

For public required string[]? OptionList { get; init; } (#​5359):

TypeScript client C# client
v14.7.0 (broken) optionList: string[] public string[] OptionList
v14.7.1 optionList: string[] | null public string[]? OptionList

For full details and truth tables across all required / [Required] / [JsonRequired] / [JsonProperty(Required=*)] combinations, see the NJsonSchema v11.6.1 release notes and NJsonSchema #​1919.

What's Changed

Full Changelog: RicoSuter/NSwag@v14.7.0...v14.7.1

14.7.0

[!CAUTION]
Do not use this release — upgrade to v14.7.1 or later.

v14.7.0 bundles NJsonSchema v11.6.0, which contained a regression that silently dropped nullability on required T? / [JsonRequired] T? DTO properties. Generated TypeScript and C# clients lost null-safety for fields the server can legitimately return as null (#​5359). Fixed in v14.7.1.


What's Changed

NJsonSchema v11.6.0 (potentially breaking changes)

This release updates to NJsonSchema v11.6.0 and Namotion.Reflection v3.5.0, which include the following changes that may affect generated code:

  • C# 11 required keyword now correctly recognized: Properties using the C# 11 required keyword (via RequiredMemberAttribute / JsonRequiredAttribute) are now properly treated as required in the schema and generated code. Previously these were incorrectly treated as optional.
  • Removed extra blank line before class declarations in generated C# controller code (cosmetic).
  • New WriteAccessor setting to control property setter syntax (set vs init).
  • New JsonLibraryVersion setting for controlling enum attribute generation with System.Text.Json.
  • Fixed MinLength validation no longer incorrectly applied to DateTime properties.
  • Fixed nullable enum array detection for string enum converters.
  • Support for public fields with System.Text.Json when IncludeFields is enabled.

For the full list of changes, see the NJsonSchema v11.6.0 release notes.

New Contributors

Full Changelog: RicoSuter/NSwag@v14.6.3...v14.7.0

Commits viewable in compare view.

@dependabot dependabot Bot added .NET Pull requests that update .NET code dependencies Pull requests that update a dependency file labels May 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Ollama Code Review for AspNetCoreSerilog/AspNetCoreSerilog.csproj:\n\nThe provided code is a Visual Studio Project file (.csproj) for an ASP.NET Web API project. Here are some suggestions for improvement, coding best practices, readability, and maintainability:

  1. Use meaningful variable names:
    • Instead of hardcoding the values in the PropertyGroup section, consider defining constants or environment variables to make the file more configurable.
  2. Consider using a more recent version of the target framework:
    • The current target framework is .net8.0. However, if you're planning to support older versions of .NET, it might be better to use net6.0 or net7.0 which are more recently released.
  3. Use the PackageReference element for multiple packages:
    • Instead of listing each package separately using ItemGroup, you can use a single PackageReference element with multiple targets, like this:

```
This approach makes the file more concise and easier to maintain.
  1. Consider using a Dockerfile instead of DockerDefaultTargetOS:
    • The DockerDefaultTargetOS property is deprecated in favor of DockerFile. It's recommended to use a Dockerfile directly, which will provide more control over the build process.
  2. Use a consistent spacing and formatting style:
    • The provided code uses inconsistent indentation (both 4 spaces and 2 spaces). It's better to stick to one of these conventions throughout the file.
  3. Consider adding comments or documentation:
    • If this project is large or complex, consider adding XML comments or a README file to explain the purpose and functionality of each part of the project.

Here's an improved version of your .csproj file incorporating some of these suggestions:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <!-- Define constants for target framework, user secrets ID, etc. -->
    <TargetFramework>net8.0</TargetFramework>
    <UserSecretsId>9d750d08-73ae-4876-83cc-4aad393eef18</UserSecretsId>
    <!-- Replace with your Dockerfile location -->
    <!-- <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> -->
  </PropertyGroup>

  <ItemGroup>
    <!-- PackageReference element for multiple packages -->
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.3.9" TargetFramework="net8.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.25" TargetFramework="net8.0" />
    <PackageReference Include="NSwag.AspNetCore" Version="14.7.1" TargetFramework="net8.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="10.0.0" TargetFramework="net8.0" />
  </ItemGroup>
</Project>

---
updated-dependencies:
- dependency-name: NSwag.AspNetCore
  dependency-version: 14.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot force-pushed the dependabot/nuget/AspNetCoreSerilog/NSwag.AspNetCore-14.7.1 branch from a545759 to 5fa22c9 Compare May 1, 2026 13:43
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Ollama Code Review for AspNetCoreSerilog/AspNetCoreSerilog.csproj:\n\nThe provided code snippet is a .csproj file, which is the standard project file format for C# and other .NET languages in Visual Studio.

Code Review

Overall, the code looks clean and well-formatted. However, here are some suggestions for improvement:

  1. Consistent indentation: The indentation in the first line is not consistent with the rest of the file. It's better to have consistent indentation throughout the entire file.
  2. Property grouping: Instead of using a nested <PropertyGroup> element, you can use the standard <PropertyGroup> element and add all properties inside it.
  3. PackageReference elements: Consider separating each PackageReference into its own line for better readability.

Improved Code

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <UserSecretsId>9d750d08-73ae-4876-83cc-4aad393eef18</UserSecretsId>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <LangVersion>default</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.3.9" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.26" />
    <PackageReference Include="NSwag.AspNetCore" Version="14.7.1" />
    <PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
    <PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
    <PackageReference Include="Serilog.Enrichers.Thread" Version="4.0.0" />
  </ItemGroup>
</Project>

Coding Best Practices

  1. Use meaningful names: Use descriptive names for your properties and package references.
  2. Follow PSCef standards: The Property Group should be in the standard format, and each PackageReference should be on a new line with its own Include and Version attributes.
  3. Keep it concise: Keep each property group and ItemGroup as short as possible while still being readable.

Readability and Maintainability

  1. Use whitespace effectively: Use blank lines to separate different sections of your code, making it easier to read and understand.
  2. Consider commenting: Consider adding comments to explain what each section of the code is doing.
  3. Keep it up-to-date: Make sure your project file is compatible with the latest versions of .NET and related frameworks.

Additional Tips

  1. Use Visual Studio's auto-formatting feature: This will help you keep your code organized and consistent throughout the entire project.
  2. Consider using a NuGet package for dependency management: Instead of manually managing dependencies, consider using a package like NuGet to simplify the process.
  3. Keep your project file concise and focused on the most important information: Avoid cluttering your project file with unnecessary properties or comments.

By following these suggestions, you can improve the readability, maintainability, and overall quality of your .csproj file.

@RiceBen RiceBen merged commit d96ac32 into main May 1, 2026
1 check passed
@dependabot dependabot Bot deleted the dependabot/nuget/AspNetCoreSerilog/NSwag.AspNetCore-14.7.1 branch May 1, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file .NET Pull requests that update .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nullable required fields are marked as not null in typescript & C#

1 participant