Skip to content

json casing on created in requestresponse#1792

Open
simen-rekkedal wants to merge 2 commits intomainfrom
test_of_support_case
Open

json casing on created in requestresponse#1792
simen-rekkedal wants to merge 2 commits intomainfrom
test_of_support_case

Conversation

@simen-rekkedal
Copy link
Contributor

@simen-rekkedal simen-rekkedal commented Jan 26, 2026

Description

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • Chores
    • Standardized JSON field naming for system response data to improve API consistency.
    • Responses now include a populated "created" timestamp where applicable, exposing creation time in returned data.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Adds JSON serialization attribute [JsonPropertyName("created")] to Created properties in two system response models and populates those Created fields in several response mappings within the request system user service.

Changes

Cohort / File(s) Summary
Model: JSON property attribute
src/Core/Models/SystemUsers/AgentRequestSystemResponse.cs, src/Core/Models/SystemUsers/RequestSystemResponse.cs
Added [JsonPropertyName("created")] attribute to the public Created property in both classes to set the JSON field name to "created"
Service: populate Created in mappings
src/Authentication/Services/RequestSystemUserService.cs
Populates the Created field on response objects in multiple mapping methods (e.g., GetRequestByExternalRef, GetRequestByGuid, GetRequestByPartyAndRequestId, GetAgentRequestByGuid, GetAgentRequestByPartyAndRequestId)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'json casing on created in requestresponse' directly describes the main change: adding JsonPropertyName attributes to specify JSON field casing for the Created property across system response models.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test_of_support_case

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Authentication/Services/RequestSystemUserService.cs (1)

416-428: Missing Created field in GetAgentRequestByGuid response mapping.

This method constructs a new AgentRequestSystemResponse but omits the Created field, whereas GetAgentRequestByPartyAndRequestId (line 513) and CheckUserAuthorizationAndGetAgentRequest (line 884) both include it. This inconsistency will result in different API responses depending on which endpoint is called.

Proposed fix
         return new AgentRequestSystemResponse()
         {
             Id = res.Id,
             IntegrationTitle = res.IntegrationTitle,
             ExternalRef = res.ExternalRef,
             SystemId = res.SystemId,
             PartyOrgNo = res.PartyOrgNo,
             AccessPackages = res.AccessPackages,
             Status = res.Status,
+            Created = res.Created,
             RedirectUrl = res.RedirectUrl,
             TimedOut = res.TimedOut
         };

@sonarqubecloud
Copy link

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.

1 participant