Skip to content

Commit ca4a1b4

Browse files
committed
fix(snippets): saveObjects playlist
1 parent 3c9646f commit ca4a1b4

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ private String inferDataType(Object param, CodegenParameter spec, Map<String, Ob
592592
spec.setIsArray(true);
593593
// This is just to find the correct path in `handlePrimitive`, but it's not always the
594594
// real type
595+
// FIXME: this set voluntarily the type to string, which will fail
596+
// We need to infer the real type
595597
CodegenProperty baseItems = new CodegenProperty();
596598
baseItems.dataType = "String";
597599
spec.setItems(baseItems);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#isRoot}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}: {{/isRoot}}{{^isRoot}}{{#useAnonymousKey}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}: {{/useAnonymousKey}}{{/isRoot}}
1+
{{#isRoot}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}: {{/isRoot}}{{^isRoot}}{{#useAnonymousKey}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}{{#isParentFreeFormObject}}{{key}}{{/isParentFreeFormObject}}{{^isParentFreeFormObject}}{{#lambda.camelcase}}{{key}}{{/lambda.camelcase}}{{/isParentFreeFormObject}}{{#isParentFreeFormObject}}"{{/isParentFreeFormObject}}{{#isAdditionalProperty}}"{{/isAdditionalProperty}}: {{/useAnonymousKey}}{{/isRoot}}

tests/CTS/client/search/saveObjects.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,60 @@
9393
}
9494
}
9595
]
96+
},
97+
{
98+
"testName": "saveObjectsPlaylist",
99+
"autoCreateClient": false,
100+
"steps": [
101+
{
102+
"type": "method",
103+
"method": "saveObjects",
104+
"parameters": {
105+
"indexName": "playlists",
106+
"objects": [
107+
{
108+
"objectID": "1",
109+
"user": "public",
110+
"name": "Hot 100 Billboard Charts",
111+
"tracks": [
112+
"Despacito",
113+
"Shape of You"
114+
],
115+
"createdAt": 1500240452
116+
}
117+
]
118+
}
119+
}
120+
]
121+
},
122+
{
123+
"testName": "saveObjectsPublicUser",
124+
"autoCreateClient": false,
125+
"steps": [
126+
{
127+
"type": "method",
128+
"method": "saveObjects",
129+
"parameters": {
130+
"indexName": "playlists",
131+
"objects": [
132+
{
133+
"objectID": "1",
134+
"user": "public",
135+
"name": "Hot 100 Billboard Charts",
136+
"tracks": [
137+
"Despacito",
138+
"Shape of You"
139+
],
140+
"createdAt": 1500240452
141+
}
142+
],
143+
"requestOptions": {
144+
"headers": {
145+
"X-Algolia-User-ID": "*"
146+
}
147+
}
148+
}
149+
}
150+
]
96151
}
97152
]

0 commit comments

Comments
 (0)