Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions AccessGridTest/ConsoleServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
}
""";

string capturedBody = null;

Check warning on line 267 in AccessGridTest/ConsoleServiceTests.cs

View workflow job for this annotation

GitHub Actions / test (8.0.x)

Converting null literal or possible null value to non-nullable type.
_mockHttpClient
.Setup(x => x.SendAsync(It.IsAny<HttpRequestMessage>()))
.Returns<HttpRequestMessage>(async req =>
Expand Down Expand Up @@ -349,7 +349,7 @@
{
var json = """{ "id": "tmpl-123", "name": "Test" }""";

string capturedBody = null;

Check warning on line 352 in AccessGridTest/ConsoleServiceTests.cs

View workflow job for this annotation

GitHub Actions / test (8.0.x)

Converting null literal or possible null value to non-nullable type.
_mockHttpClient
.Setup(x => x.SendAsync(It.IsAny<HttpRequestMessage>()))
.Returns<HttpRequestMessage>(async req =>
Expand Down Expand Up @@ -1160,6 +1160,33 @@
)), Times.Once);
}

[Test]
public async Task CredentialProfilesListAsync_HandlesNullNumericFields()
{
// The API can return null for keys_diversified and file_size; the SDK
// previously typed these as non-nullable bool/int and crashed.
var json = """
[
{
"id": "cp_1",
"name": "Profile",
"keys": [
{ "ex_id": "key_1", "label": "Master Key", "keys_diversified": null, "source_key_index": null }
],
"files": [
{ "ex_id": "file_1", "file_type": "Standard", "file_size": null }
]
}
]
""";
StubHttpResponse(json);

var result = await _client.Console.CredentialProfiles.ListAsync();

Assert.That(result[0].Keys[0].KeysDiversified, Is.Null);
Assert.That(result[0].Files[0].FileSize, Is.Null);
}

[Test]
public async Task CredentialProfilesListAsync_ShouldHandleEmptyList()
{
Expand Down
4 changes: 2 additions & 2 deletions src/AccessGrid/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ public class CredentialProfileKey
public string Label { get; set; }

[JsonPropertyName("keys_diversified")]
public bool KeysDiversified { get; set; }
public bool? KeysDiversified { get; set; }

[JsonPropertyName("source_key_index")]
public int? SourceKeyIndex { get; set; }
Expand All @@ -1213,7 +1213,7 @@ public class CredentialProfileFile
public string FileType { get; set; }

[JsonPropertyName("file_size")]
public int FileSize { get; set; }
public int? FileSize { get; set; }

[JsonPropertyName("communication_settings")]
public string CommunicationSettings { get; set; }
Expand Down
Loading