Skip to content

Update to fix Lists/Arrays of nullables not getting marked as nullable #3364

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

Merged
merged 4 commits into from
Apr 14, 2025

Conversation

Scarecrow7250
Copy link
Contributor

@Scarecrow7250 Scarecrow7250 commented Apr 11, 2025

Pull Request

The issue or feature being addressed

This Pull Request should hopefully address an issue where Arrays/Lists of Nullable types where not getting correctly marked as Nullable in the generated swagger.

Resolves #3284

Details on the issue fix or feature implementation

In GenerateSchema -> GenerateSchemaForType I added a check to see if the Array underlying type was nullable. If so, it would mark the corresponding section in the schema (in this case items) with nullable = true.

@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.47%. Comparing base (01eca21) to head (36f4b93).
Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
...Core.SwaggerGen/SchemaGenerator/SchemaGenerator.cs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3364      +/-   ##
==========================================
- Coverage   84.74%   83.47%   -1.28%     
==========================================
  Files          84       84              
  Lines        3278     3280       +2     
  Branches      571      572       +1     
==========================================
- Hits         2778     2738      -40     
- Misses        500      542      +42     
Flag Coverage Δ
Linux 83.47% <50.00%> (-0.03%) ⬇️
Windows 83.47% <50.00%> (+18.43%) ⬆️
macOS 83.47% <50.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments.

@martincostello martincostello added this to the v8.1.2 milestone Apr 14, 2025
Copy link
Collaborator

@martincostello martincostello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@martincostello martincostello merged commit 356c595 into domaindrivendev:master Apr 14, 2025
14 of 15 checks passed
This was referenced Jul 28, 2025
This was referenced Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I get arrays of nullable types to be represented with a nullable flag in "items" in swagger
4 participants