LifeOfVio
LifeOfVio
Explore posts from servers
IImmich
Created by LifeOfVio on 1/24/2025 in #help-desk-support
Random Endpoint broken?
is the /search/random endpoint broken? I just tried to receive data with this body {"size":250.0,"type":"IMAGE","withArchived":false,"withExif":true,"withPeople":true} logs show
[Nest] 17 - 01/24/2025, 11:40:34 AM ERROR [Api:ErrorInterceptor~7afn8q5z] Unknown error: TypeError: items.map is not a function
TypeError: items.map is not a function
at SearchService.searchRandom (/usr/src/app/dist/services/search.service.js:52:22)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[Nest] 17 - 01/24/2025, 11:40:34 AM ERROR [Api:ErrorInterceptor~7afn8q5z] Unknown error: TypeError: items.map is not a function
TypeError: items.map is not a function
at SearchService.searchRandom (/usr/src/app/dist/services/search.service.js:52:22)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Version: 1.125.1
6 replies
CC#
Created by LifeOfVio on 9/24/2024 in #help
✅ OpenApi generation
I have following class generated from swagger
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v11.0.0.0))")]
public partial class RandomSearchDto
{
[Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; set; }

[Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Country { get; set; }

[Newtonsoft.Json.JsonProperty("createdAfter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset CreatedAfter { get; set; }

[Newtonsoft.Json.JsonProperty("createdBefore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset CreatedBefore { get; set; }
...
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v11.0.0.0))")]
public partial class RandomSearchDto
{
[Newtonsoft.Json.JsonProperty("city", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string City { get; set; }

[Newtonsoft.Json.JsonProperty("country", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Country { get; set; }

[Newtonsoft.Json.JsonProperty("createdAfter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset CreatedAfter { get; set; }

[Newtonsoft.Json.JsonProperty("createdBefore", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.DateTimeOffset CreatedBefore { get; set; }
...
}
My issue is that when I create an instance of RandomSearchDto like this -> var searchBody = new RandomSearchDto();, the CreatedAfter and CreatedBefore properties have a default value (because they are not nullable). How can I generate this so that the DateTimeOffsets are generated as nullable?
39 replies