Problem
Two low-severity REST compliance gaps identified during a full RESTful audit:
GET /players returns 404 Not Found when the collection is empty instead of 200 OK []
- The
Player → PlayerResponseModel AutoMapper mapping does not explicitly ignore the Id (UUID) field — it works correctly today only because PlayerResponseModel has no Id property, not by design intent
Proposed Solution
- Return
200 OK with an empty list when no players exist — a 404 implies the resource itself is absent, not that the list is empty
- Add an explicit
.ForMember(dest => dest.Id, opt => opt.Ignore()) (or equivalent) to the output mapping to make the exclusion intentional and future-proof
Suggested Approach
Empty collection (GET /players):
Controllers/PlayerController.cs lines 99–113 — replace the players.Count == 0 branch from TypedResults.Problem(404) to TypedResults.Ok(Array.Empty<PlayerResponseModel>()) (or TypedResults.Ok(players) directly, since an empty list is a valid 200 response)
AutoMapper explicit ignore:
Mappings/PlayerMappingProfile.cs — in the Player → PlayerResponseModel map, add explicit ignore for Id (if PlayerResponseModel gains an Id property in the future AutoMapper would silently populate it and leak the surrogate key; an explicit ignore fails fast instead)
- Consider enabling
ValidateMemberList on the mapping profile to enforce that all destination members are intentionally mapped or ignored
Acceptance Criteria
References
Problem
Two low-severity REST compliance gaps identified during a full RESTful audit:
GET /playersreturns404 Not Foundwhen the collection is empty instead of200 OK []Player → PlayerResponseModelAutoMapper mapping does not explicitly ignore theId(UUID) field — it works correctly today only becausePlayerResponseModelhas noIdproperty, not by design intentProposed Solution
200 OKwith an empty list when no players exist — a 404 implies the resource itself is absent, not that the list is empty.ForMember(dest => dest.Id, opt => opt.Ignore())(or equivalent) to the output mapping to make the exclusion intentional and future-proofSuggested Approach
Empty collection (
GET /players):Controllers/PlayerController.cslines 99–113 — replace theplayers.Count == 0branch fromTypedResults.Problem(404)toTypedResults.Ok(Array.Empty<PlayerResponseModel>())(orTypedResults.Ok(players)directly, since an empty list is a valid 200 response)AutoMapper explicit ignore:
Mappings/PlayerMappingProfile.cs— in thePlayer → PlayerResponseModelmap, add explicit ignore forId(ifPlayerResponseModelgains anIdproperty in the future AutoMapper would silently populate it and leak the surrogate key; an explicit ignore fails fast instead)ValidateMemberListon the mapping profile to enforce that all destination members are intentionally mapped or ignoredAcceptance Criteria
GET /playersreturns200 OKwith[]when no players exist (not404)Idon thePlayer → PlayerResponseModelmappingReferences
200 []on empty, not404