Skip to content

Conversation

@paulirwin
Copy link
Member

  • Allow null as response value by making Content property nullable
  • Add comprehensive unit tests for HypermediaResponse class
  • Tests cover constructor behavior, links management, and serialization
  • All 34 tests pass on both .NET 8.0 and .NET 6.0 frameworks

Fixes #2: The latest release enabling nullable reference types unintentionally prohibits returning null in HypermediaResponse

- Allow null as response value by making Content property nullable
- Add comprehensive unit tests for HypermediaResponse class
- Tests cover constructor behavior, links management, and serialization
- All 34 tests pass on both .NET 8.0 and .NET 6.0 frameworks
Fixes #2: The latest release enabling nullable reference types unintentionally prohibits returning null in HypermediaResponse
@paulirwin paulirwin requested a review from Copilot August 11, 2025 16:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a nullable reference types issue in the HypermediaResponse class by allowing null content values. The change addresses issue #2 where the latest release with nullable reference types unintentionally prevented returning null responses.

  • Made the Content property nullable by changing object to object? in both constructor parameter and property
  • Added comprehensive unit tests covering constructor behavior, links management, and serialization scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
F23.Hateoas/HypermediaResponse.cs Updated constructor parameter and Content property to accept nullable objects
F23.Hateoas.Tests/HypermediaResponseTests.cs Added 12 comprehensive unit tests covering null content scenarios, links management, and serialization

@paulirwin paulirwin merged commit 15f858d into main Aug 11, 2025
1 check passed
@paulirwin paulirwin deleted the issue/2 branch August 11, 2025 16:34
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.

Allow nulls in HypermediaResponse

2 participants