Skip to content

Commit c917710

Browse files
authored
fix(specs): types and parameters (#708)
1 parent 937c5a6 commit c917710

File tree

8 files changed

+346
-27
lines changed

8 files changed

+346
-27
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ private IJsonSchemaValidationProperties findMatchingOneOf(Object param, CodegenM
546546
}
547547
}
548548
for (CodegenModel oneOf : model.interfaceModels) {
549-
if (oneOf.dataType.equals(paramType)) return oneOf;
549+
// Somehow the dataType can be in lower case?
550+
if (oneOf.dataType.toLowerCase().equals(paramType.toLowerCase())) {
551+
return oneOf;
552+
}
550553
}
551554
return null;
552555
}

specs/common/schemas/IndexSettings.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ baseIndexSettings:
4545
type: string
4646
description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
4747
default: []
48-
filterPromotes:
49-
type: boolean
50-
description: Whether promoted results should match the filters of the current search, except for geographic filters.
51-
default: false
5248
disablePrefixOnAttributes:
5349
type: array
5450
items:
@@ -65,19 +61,23 @@ baseIndexSettings:
6561
type: string
6662
description: List of numeric attributes that can be used as numerical filters.
6763
default: []
64+
separatorsToIndex:
65+
type: string
66+
description: Control which separators are indexed.
67+
default: ''
68+
searchableAttributes:
69+
type: array
70+
items:
71+
type: string
72+
description: The complete list of attributes used for searching.
73+
default: []
6874
userData:
6975
$ref: '#/userData'
7076

7177
indexSettingsAsSearchParams:
7278
type: object
7379
additionalProperties: false
7480
properties:
75-
searchableAttributes:
76-
type: array
77-
items:
78-
type: string
79-
description: The complete list of attributes used for searching.
80-
default: []
8181
attributesForFaceting:
8282
type: array
8383
items:
@@ -175,18 +175,10 @@ indexSettingsAsSearchParams:
175175
type: string
176176
description: List of attributes on which you want to disable typo tolerance.
177177
default: []
178-
separatorsToIndex:
179-
type: string
180-
description: Control which separators are indexed.
181-
default: ''
182178
ignorePlurals:
183-
type: string
184-
description: Treats singular, plurals, and other forms of declensions as matching terms.
185-
default: false
179+
$ref: '#/ignorePlurals'
186180
removeStopWords:
187-
type: string
188-
description: Removes stop (common) words from the query before executing it.
189-
default: false
181+
$ref: '#/removeStopWords'
190182
keepDiacriticsOnCharacters:
191183
type: string
192184
description: List of characters that the engine shouldn't automatically normalize.
@@ -327,3 +319,35 @@ alternativesAsExact:
327319
advancedSyntaxFeatures:
328320
type: string
329321
enum: [exactPhrase, excludeWords]
322+
323+
ignorePlurals:
324+
description: >
325+
Treats singular, plurals, and other forms of declensions as matching terms.
326+
327+
ignorePlurals is used in conjunction with the queryLanguages setting.
328+
329+
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages.
330+
true: enables the ignore plurals functionality, where singulars and plurals are considered equivalent (foot = feet). The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages.
331+
false: disables ignore plurals, where singulars and plurals are not considered the same for matching purposes (foot will not find feet).
332+
oneOf:
333+
- type: array
334+
items:
335+
type: string
336+
- type: boolean
337+
default: false
338+
339+
removeStopWords:
340+
description: >
341+
Removes stop (common) words from the query before executing it.
342+
343+
removeStopWords is used in conjunction with the queryLanguages setting.
344+
345+
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages.
346+
true: enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language, or those set by queryLanguages.
347+
false: disables stop word functionality, allowing stop words to be taken into account in a search.
348+
oneOf:
349+
- type: array
350+
items:
351+
type: string
352+
- type: boolean
353+
default: false

specs/common/schemas/SearchParams.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ baseSearchParams:
8484
type: array
8585
items:
8686
type: number
87+
format: double
8788
description: Search inside a rectangular area (in geo coordinates).
8889
insidePolygon:
8990
type: array
9091
items:
9192
type: number
93+
format: double
9294
description: Search inside a polygon (in geo coordinates).
9395
naturalLanguages:
9496
type: array

specs/predict/paths/fetchUserProfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ post:
4343
type: string
4444
probability:
4545
type: number
46+
format: double
4647
minimum: 0
4748
maximum: 1
4849
lastUpdatedAt:
@@ -53,6 +54,7 @@ post:
5354
properties:
5455
value:
5556
type: number
57+
format: double
5658
minimum: 0
5759
lastUpdatedAt:
5860
type: string
@@ -72,6 +74,7 @@ post:
7274
type: string
7375
probability:
7476
type: number
77+
format: double
7578
minimum: 0
7679
maximum: 1
7780
lastUpdatedAt:

specs/search/common/schemas/SearchQuery.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ searchForFacetsOptions:
2222
indexName:
2323
$ref: '../../../common/parameters.yml#/indexName'
2424
facetQuery:
25-
type: string
26-
description: Text to search inside the facet's values.
27-
default: ''
25+
$ref: '#/facetQuery'
2826
maxFacetHits:
2927
$ref: '../../../common/schemas/IndexSettings.yml#/maxFacetHits'
3028
type:
@@ -34,6 +32,11 @@ searchForFacetsOptions:
3432
- type
3533
- facet
3634

35+
facetQuery:
36+
type: string
37+
description: Text to search inside the facet's values.
38+
default: ''
39+
3740
searchForHitsOptions:
3841
# We provide this option because TypeScript can't distinguish union with optional keys
3942
# if they are not completely the same, see usage in `templates/javascript/model.mustache`

specs/search/paths/search/searchForFacetValues.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ post:
2525
params:
2626
$ref: '../../../common/schemas/SearchParams.yml#/paramsAsString'
2727
facetQuery:
28-
type: string
29-
description: Text to search inside the facet's values.
30-
default: ''
28+
$ref: '../../common/schemas/SearchQuery.yml#/facetQuery'
3129
maxFacetHits:
3230
$ref: '../../../common/schemas/IndexSettings.yml#/maxFacetHits'
3331
responses:

templates/java/oneof_interface.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.google.gson.annotations.JsonAdapter;
77
import com.google.gson.stream.JsonReader;
88
import com.google.gson.stream.JsonWriter;
99
import java.io.IOException;
10+
import java.util.List;
1011

1112
@JsonAdapter({{classname}}.Adapter.class)
1213
{{>additionalModelTypeAnnotations}}

0 commit comments

Comments
 (0)