diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/GetRecommendationsResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/GetRecommendationsResponse.cs
index bc37e40693..24be8cdb0b 100644
--- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/GetRecommendationsResponse.cs
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Recommend/GetRecommendationsResponse.cs
@@ -19,8 +19,15 @@ public partial class GetRecommendationsResponse
///
/// Initializes a new instance of the GetRecommendationsResponse class.
///
- public GetRecommendationsResponse()
+ [JsonConstructor]
+ public GetRecommendationsResponse() { }
+ ///
+ /// Initializes a new instance of the GetRecommendationsResponse class.
+ ///
+ /// results (required).
+ public GetRecommendationsResponse(List results)
{
+ Results = results ?? throw new ArgumentNullException(nameof(results));
}
///
diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.dart
index 2ebadc9646..febff949d9 100644
--- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.dart
+++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.dart
@@ -10,11 +10,11 @@ part 'get_recommendations_response.g.dart';
final class GetRecommendationsResponse {
/// Returns a new [GetRecommendationsResponse] instance.
const GetRecommendationsResponse({
- this.results,
+ required this.results,
});
@JsonKey(name: r'results')
- final List? results;
+ final List results;
@override
bool operator ==(Object other) =>
diff --git a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.g.dart b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.g.dart
index fd62b2ba06..d8bdaf0d1b 100644
--- a/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.g.dart
+++ b/clients/algoliasearch-client-dart/packages/algoliasearch/lib/src/model/get_recommendations_response.g.dart
@@ -15,8 +15,8 @@ GetRecommendationsResponse _$GetRecommendationsResponseFromJson(
final val = GetRecommendationsResponse(
results: $checkedConvert(
'results',
- (v) => (v as List?)
- ?.map((e) => RecommendationsResults.fromJson(
+ (v) => (v as List)
+ .map((e) => RecommendationsResults.fromJson(
e as Map))
.toList()),
);
@@ -25,15 +25,7 @@ GetRecommendationsResponse _$GetRecommendationsResponseFromJson(
);
Map _$GetRecommendationsResponseToJson(
- GetRecommendationsResponse instance) {
- final val = {};
-
- void writeNotNull(String key, dynamic value) {
- if (value != null) {
- val[key] = value;
- }
- }
-
- writeNotNull('results', instance.results?.map((e) => e.toJson()).toList());
- return val;
-}
+ GetRecommendationsResponse instance) =>
+ {
+ 'results': instance.results.map((e) => e.toJson()).toList(),
+ };
diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/example/example.dart b/clients/algoliasearch-client-dart/packages/client_recommend/example/example.dart
index bec1b5c2fc..869bfa9d15 100644
--- a/clients/algoliasearch-client-dart/packages/client_recommend/example/example.dart
+++ b/clients/algoliasearch-client-dart/packages/client_recommend/example/example.dart
@@ -40,10 +40,6 @@ void main() async {
/// Prints the search hits.
void printRecommendations(GetRecommendationsResponse response) {
final results = response.results;
- if (results == null) {
- print("No recommendations found");
- return;
- }
// Loop over each result and map over the search hits,
// converting each hit to a product.
diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.dart
index 31524f63a1..42b68e4cf0 100644
--- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.dart
+++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.dart
@@ -10,11 +10,11 @@ part 'get_recommendations_response.g.dart';
final class GetRecommendationsResponse {
/// Returns a new [GetRecommendationsResponse] instance.
const GetRecommendationsResponse({
- this.results,
+ required this.results,
});
@JsonKey(name: r'results')
- final List? results;
+ final List results;
@override
bool operator ==(Object other) =>
diff --git a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.g.dart b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.g.dart
index fd62b2ba06..d8bdaf0d1b 100644
--- a/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.g.dart
+++ b/clients/algoliasearch-client-dart/packages/client_recommend/lib/src/model/get_recommendations_response.g.dart
@@ -15,8 +15,8 @@ GetRecommendationsResponse _$GetRecommendationsResponseFromJson(
final val = GetRecommendationsResponse(
results: $checkedConvert(
'results',
- (v) => (v as List?)
- ?.map((e) => RecommendationsResults.fromJson(
+ (v) => (v as List)
+ .map((e) => RecommendationsResults.fromJson(
e as Map))
.toList()),
);
@@ -25,15 +25,7 @@ GetRecommendationsResponse _$GetRecommendationsResponseFromJson(
);
Map _$GetRecommendationsResponseToJson(
- GetRecommendationsResponse instance) {
- final val = {};
-
- void writeNotNull(String key, dynamic value) {
- if (value != null) {
- val[key] = value;
- }
- }
-
- writeNotNull('results', instance.results?.map((e) => e.toJson()).toList());
- return val;
-}
+ GetRecommendationsResponse instance) =>
+ {
+ 'results': instance.results.map((e) => e.toJson()).toList(),
+ };
diff --git a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_response.go b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_response.go
index 16bd866bf8..24dcc4b85d 100644
--- a/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_response.go
+++ b/clients/algoliasearch-client-go/algolia/recommend/model_get_recommendations_response.go
@@ -8,26 +8,16 @@ import (
// GetRecommendationsResponse struct for GetRecommendationsResponse.
type GetRecommendationsResponse struct {
- Results []RecommendationsResults `json:"results,omitempty"`
-}
-
-type GetRecommendationsResponseOption func(f *GetRecommendationsResponse)
-
-func WithGetRecommendationsResponseResults(val []RecommendationsResults) GetRecommendationsResponseOption {
- return func(f *GetRecommendationsResponse) {
- f.Results = val
- }
+ Results []RecommendationsResults `json:"results"`
}
// NewGetRecommendationsResponse instantiates a new GetRecommendationsResponse object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
-func NewGetRecommendationsResponse(opts ...GetRecommendationsResponseOption) *GetRecommendationsResponse {
+func NewGetRecommendationsResponse(results []RecommendationsResults) *GetRecommendationsResponse {
this := &GetRecommendationsResponse{}
- for _, opt := range opts {
- opt(this)
- }
+ this.Results = results
return this
}
@@ -36,34 +26,26 @@ func NewEmptyGetRecommendationsResponse() *GetRecommendationsResponse {
return &GetRecommendationsResponse{}
}
-// GetResults returns the Results field value if set, zero value otherwise.
+// GetResults returns the Results field value.
func (o *GetRecommendationsResponse) GetResults() []RecommendationsResults {
- if o == nil || o.Results == nil {
+ if o == nil {
var ret []RecommendationsResults
return ret
}
+
return o.Results
}
-// GetResultsOk returns a tuple with the Results field value if set, nil otherwise
+// GetResultsOk returns a tuple with the Results field value
// and a boolean to check if the value has been set.
func (o *GetRecommendationsResponse) GetResultsOk() ([]RecommendationsResults, bool) {
- if o == nil || o.Results == nil {
+ if o == nil {
return nil, false
}
return o.Results, true
}
-// HasResults returns a boolean if a field has been set.
-func (o *GetRecommendationsResponse) HasResults() bool {
- if o != nil && o.Results != nil {
- return true
- }
-
- return false
-}
-
-// SetResults gets a reference to the given []RecommendationsResults and assigns it to the Results field.
+// SetResults sets field value.
func (o *GetRecommendationsResponse) SetResults(v []RecommendationsResults) *GetRecommendationsResponse {
o.Results = v
return o
@@ -71,7 +53,7 @@ func (o *GetRecommendationsResponse) SetResults(v []RecommendationsResults) *Get
func (o GetRecommendationsResponse) MarshalJSON() ([]byte, error) {
toSerialize := map[string]any{}
- if o.Results != nil {
+ if true {
toSerialize["results"] = o.Results
}
serialized, err := json.Marshal(toSerialize)
diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/GetRecommendationsResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/GetRecommendationsResponse.java
index 502869507c..6bd29d54ed 100644
--- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/GetRecommendationsResponse.java
+++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/recommend/GetRecommendationsResponse.java
@@ -13,7 +13,7 @@
public class GetRecommendationsResponse {
@JsonProperty("results")
- private List results;
+ private List results = new ArrayList<>();
public GetRecommendationsResponse setResults(List results) {
this.results = results;
@@ -21,15 +21,12 @@ public GetRecommendationsResponse setResults(List result
}
public GetRecommendationsResponse addResults(RecommendationsResults resultsItem) {
- if (this.results == null) {
- this.results = new ArrayList<>();
- }
this.results.add(resultsItem);
return this;
}
/** Get results */
- @javax.annotation.Nullable
+ @javax.annotation.Nonnull
public List getResults() {
return results;
}
diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/getRecommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/getRecommendationsResponse.ts
index c49a838a8c..6e20b580db 100644
--- a/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/getRecommendationsResponse.ts
+++ b/clients/algoliasearch-client-javascript/packages/algoliasearch/lite/model/getRecommendationsResponse.ts
@@ -3,5 +3,5 @@
import type { RecommendationsResults } from './recommendationsResults';
export type GetRecommendationsResponse = {
- results?: RecommendationsResults[];
+ results: RecommendationsResults[];
};
diff --git a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts
index c49a838a8c..6e20b580db 100644
--- a/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts
+++ b/clients/algoliasearch-client-javascript/packages/recommend/model/getRecommendationsResponse.ts
@@ -3,5 +3,5 @@
import type { RecommendationsResults } from './recommendationsResults';
export type GetRecommendationsResponse = {
- results?: RecommendationsResults[];
+ results: RecommendationsResults[];
};
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/GetRecommendationsResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/GetRecommendationsResponse.kt
index f35cb146e9..52303d204b 100644
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/GetRecommendationsResponse.kt
+++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/recommend/GetRecommendationsResponse.kt
@@ -12,5 +12,5 @@ import kotlinx.serialization.json.*
@Serializable
public data class GetRecommendationsResponse(
- @SerialName(value = "results") val results: List? = null,
+ @SerialName(value = "results") val results: List,
)
diff --git a/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendationsResponse.php b/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendationsResponse.php
index c31189e597..51a5c1c5f4 100644
--- a/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendationsResponse.php
+++ b/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendationsResponse.php
@@ -136,7 +136,13 @@ public static function getters()
*/
public function listInvalidProperties()
{
- return [];
+ $invalidProperties = [];
+
+ if (!isset($this->container['results']) || null === $this->container['results']) {
+ $invalidProperties[] = "'results' can't be null";
+ }
+
+ return $invalidProperties;
}
/**
@@ -153,7 +159,7 @@ public function valid()
/**
* Gets results.
*
- * @return null|\Algolia\AlgoliaSearch\Model\Recommend\RecommendationsResults[]
+ * @return \Algolia\AlgoliaSearch\Model\Recommend\RecommendationsResults[]
*/
public function getResults()
{
@@ -163,7 +169,7 @@ public function getResults()
/**
* Sets results.
*
- * @param null|\Algolia\AlgoliaSearch\Model\Recommend\RecommendationsResults[] $results results
+ * @param \Algolia\AlgoliaSearch\Model\Recommend\RecommendationsResults[] $results results
*
* @return self
*/
diff --git a/clients/algoliasearch-client-python/algoliasearch/recommend/models/get_recommendations_response.py b/clients/algoliasearch-client-python/algoliasearch/recommend/models/get_recommendations_response.py
index d5eab1e696..1fbf060b41 100644
--- a/clients/algoliasearch-client-python/algoliasearch/recommend/models/get_recommendations_response.py
+++ b/clients/algoliasearch-client-python/algoliasearch/recommend/models/get_recommendations_response.py
@@ -7,7 +7,7 @@
from __future__ import annotations
from json import loads
-from typing import Any, Dict, List, Optional, Self
+from typing import Any, Dict, List, Self
from pydantic import BaseModel, ConfigDict
@@ -21,7 +21,7 @@ class GetRecommendationsResponse(BaseModel):
GetRecommendationsResponse
"""
- results: Optional[List[RecommendationsResults]] = None
+ results: List[RecommendationsResults]
model_config = ConfigDict(
use_enum_values=True, populate_by_name=True, validate_assignment=True
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/get_recommendations_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/get_recommendations_response.rb
index c7755a13b9..0f5397f480 100644
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/get_recommendations_response.rb
+++ b/clients/algoliasearch-client-ruby/lib/algolia/models/recommend/get_recommendations_response.rb
@@ -61,6 +61,8 @@ def initialize(attributes = {})
if (value = attributes[:results]).is_a?(Array)
self.results = value
end
+ else
+ self.results = nil
end
end
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/GetRecommendationsResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/GetRecommendationsResponse.scala
index cdf66381a0..f96751c043 100644
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/GetRecommendationsResponse.scala
+++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/recommend/GetRecommendationsResponse.scala
@@ -32,5 +32,5 @@ package algoliasearch.recommend
/** GetRecommendationsResponse
*/
case class GetRecommendationsResponse(
- results: Option[Seq[RecommendationsResults]] = scala.None
+ results: Seq[RecommendationsResults]
)
diff --git a/clients/algoliasearch-client-swift/Sources/Recommend/Models/GetRecommendationsResponse.swift b/clients/algoliasearch-client-swift/Sources/Recommend/Models/GetRecommendationsResponse.swift
index b167530e66..4870456e14 100644
--- a/clients/algoliasearch-client-swift/Sources/Recommend/Models/GetRecommendationsResponse.swift
+++ b/clients/algoliasearch-client-swift/Sources/Recommend/Models/GetRecommendationsResponse.swift
@@ -7,9 +7,9 @@ import Foundation
#endif
public struct GetRecommendationsResponse: Codable, JSONEncodable {
- public var results: [RecommendationsResults]?
+ public var results: [RecommendationsResults]
- public init(results: [RecommendationsResults]? = nil) {
+ public init(results: [RecommendationsResults]) {
self.results = results
}
@@ -21,7 +21,7 @@ public struct GetRecommendationsResponse: Codable, JSONEncodable {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.results, forKey: .results)
+ try container.encode(self.results, forKey: .results)
}
}
@@ -33,6 +33,6 @@ extension GetRecommendationsResponse: Equatable {
extension GetRecommendationsResponse: Hashable {
public func hash(into hasher: inout Hasher) {
- hasher.combine(self.results?.hashValue)
+ hasher.combine(self.results.hashValue)
}
}
diff --git a/scripts/cts/runCts.ts b/scripts/cts/runCts.ts
index 24533c3782..9f6737aa98 100644
--- a/scripts/cts/runCts.ts
+++ b/scripts/cts/runCts.ts
@@ -23,7 +23,12 @@ async function runCtsOne(
const e2eFolder = toAbsolutePath(
`tests/output/${language}/${getTestOutputFolder(language)}/e2e`,
);
- if ((await exists(e2eFolder)) && (await fsp.readdir(e2eFolder)).length > 0) folders.push('e2e');
+ if (
+ (await exists(e2eFolder)) &&
+ (await fsp.readdir(e2eFolder)).filter((f) => f !== '__init__.py' && f !== '__pycache__')
+ .length > 0
+ )
+ folders.push('e2e');
}
if (!excludeUnit) {
folders.push('client', 'requests');
diff --git a/specs/bundled/algoliasearch.yml b/specs/bundled/algoliasearch.yml
index a1811eaec6..8f00867f2a 100644
--- a/specs/bundled/algoliasearch.yml
+++ b/specs/bundled/algoliasearch.yml
@@ -413,6 +413,8 @@ paths:
type: array
items:
$ref: '#/components/schemas/recommendationsResults'
+ required:
+ - results
'400':
$ref: '#/components/responses/BadRequest'
'402':
diff --git a/specs/bundled/recommend.doc.yml b/specs/bundled/recommend.doc.yml
index 1b9b679e8d..c381a3e1e0 100644
--- a/specs/bundled/recommend.doc.yml
+++ b/specs/bundled/recommend.doc.yml
@@ -1020,6 +1020,8 @@ paths:
type: array
items:
$ref: '#/components/schemas/recommendationsResults'
+ required:
+ - results
'400':
$ref: '#/components/responses/BadRequest'
'402':
diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml
index b96740a249..f5bc574305 100644
--- a/specs/bundled/recommend.yml
+++ b/specs/bundled/recommend.yml
@@ -302,6 +302,8 @@ paths:
type: array
items:
$ref: '#/components/schemas/recommendationsResults'
+ required:
+ - results
'400':
$ref: '#/components/responses/BadRequest'
'402':
diff --git a/specs/recommend/paths/getRecommendations.yml b/specs/recommend/paths/getRecommendations.yml
index 4894c50edf..359896c663 100644
--- a/specs/recommend/paths/getRecommendations.yml
+++ b/specs/recommend/paths/getRecommendations.yml
@@ -41,6 +41,8 @@ post:
type: array
items:
$ref: '../common/schemas/RecommendationsResponse.yml#/recommendationsResults'
+ required:
+ - results
'400':
$ref: '../../common/responses/BadRequest.yml'
'402':