Conversation
- 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
There was a problem hiding this comment.
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
objecttoobject?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2: The latest release enabling nullable reference types unintentionally prohibits returning null in HypermediaResponse