Skip to content

Omit null OpenAPI response descriptions - #3077

Merged
Vincent Biret (baywet) merged 3 commits into
mainfrom
copilot/fix-description-null-issue
Sep 11, 2026
Merged

Omit null OpenAPI response descriptions#3077
Vincent Biret (baywet) merged 3 commits into
mainfrom
copilot/fix-description-null-issue

Conversation

Copilot AI commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

OpenAPI response descriptions must be strings when present. Responses with no description were serialized as "description": null, which Swagger Editor rejects.

"200": {}

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Related Issue(s)

Changes Made

  • Serialization
    • Omit description from OpenApiResponse when Description is null.
  • Coverage
    • Added response serialization coverage for OpenAPI 2.0, 3.0, 3.1, and 3.2.
  • Expectations
    • Updated affected operation serialization baselines.

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Versions applicability

  • My change applies to the version 1.X of the library, if so PR link:
  • My change applies to the version 2.X of the library, if so PR link:
  • My change applies to the version 3.X of the library, if so PR link:
  • I have evaluated the applicability of my change against the other versions above.

Additional Notes

None.

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue of null description in OpenApi response Omit null OpenAPI response descriptions Sep 10, 2026
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall line coverage in commit aadddd7 in the copilot/fix-descript... branch remains at 32%, unchanged from commit 1dae1ff in the main branch.

Show a line coverage summary of the most impacted files.
File main 1dae1ff copilot/fix-descript... aadddd7 +/-
_/src/Moq/Interception/Mock.cs 0% 11% +11%
_/src/Moq/MethodCall.cs 0% 18% +18%
_/src/Moq/Extensions.cs 0% 18% +18%
_/src/Moq/Prote...rotectedMock.cs 0% 19% +19%
_/src/Moq/Inter...ProxyFactory.cs 0% 20% +20%
_/src/Moq/Mock`1.cs 0% 26% +26%
_/src/Moq/MethodExpectation.cs 0% 40% +40%
_/src/Humanizer...s/Vocabulary.cs 0% 68% +68%
_/src/Moq/MatcherObserver.cs 0% 74% +74%
_/src/Humanizer...Vocabularies.cs 0% 100% +100%

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The fix is covered by cross-version tests with no unresolved issues.

Pull request overview

This pull request fixes OpenAPI response serialization by omitting null description fields.

Changes:

  • Omits null descriptions across OpenAPI 2.0–3.2.
  • Adds cross-version serialization coverage.
  • Updates affected serialization baselines.
File summaries
File Description
test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs Updates empty-response expectations.
test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs Updates operation serialization baselines.
test/Microsoft.OpenApi.Tests/Mocks/OpenApiResponseSerializationTests.cs Adds cross-version coverage.
src/Microsoft.OpenApi/Models/OpenApiResponse.cs Omits null descriptions during serialization.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sonarqubecloud

Copy link
Copy Markdown

@baywet
Vincent Biret (baywet) merged commit afd4967 into main Sep 11, 2026
20 checks passed
@baywet
Vincent Biret (baywet) deleted the copilot/fix-description-null-issue branch September 11, 2026 19:04
Vincent Biret (baywet) added a commit that referenced this pull request Sep 11, 2026
* Omit null OpenAPI response descriptions (#3077)

* Initial plan

fix(openapi): omit null response descriptions

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

* test(models): update response serialization expectation

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

* chore: fixes wrong merge

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Description in Response cannot be null

4 participants