Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(specs): correct type for renderingContent and consequenceParams #759

Merged
merged 4 commits into from
Jun 27, 2022
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
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.6
0.0.7
2 changes: 1 addition & 1 deletion .redocly.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiDefinitions:
apis:
abtesting: specs/abtesting/spec.yml
analytics: specs/analytics/spec.yml
insights: specs/insights/spec.yml
Expand Down
6 changes: 3 additions & 3 deletions config/openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
"generators": {
"javascript-search": {
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/client-search",
"reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions",
"reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions,delete=delete",
"additionalProperties": {
"packageVersion": "0.6.1"
}
},
"javascript-lite": {
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/algoliasearch/lite",
"reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions",
"reservedWordsMappings": "queryParameters=queryParameters,requestOptions=requestOptions,delete=delete",
"additionalProperties": {
"packageVersion": "0.6.1"
}
},
"javascript-recommend": {
"output": "#{cwd}/clients/algoliasearch-client-javascript/packages/recommend",
"reservedWordsMappings": "queryParameters=queryParameters",
"reservedWordsMappings": "queryParameters=queryParameters,delete=delete",
"additionalProperties": {
"packageVersion": "0.6.1"
}
Expand Down
60 changes: 57 additions & 3 deletions specs/common/schemas/IndexSettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ indexSettingsAsSearchParams:
description: When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.
default: false
renderingContent:
type: object
description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
default: {}
$ref: '#/renderingContent'

maxFacetHits:
type: integer
Expand Down Expand Up @@ -356,3 +354,59 @@ removeStopWords:
type: string
- type: boolean
default: false

renderingContent:
description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
type: object
additionalProperties: false
properties:
facetOrdering:
$ref: '#/facetOrdering'

facetOrdering:
description: Defining how facets should be ordered.
type: object
additionalProperties: false
properties:
facets:
$ref: '#/facets'
values:
$ref: '#/values'

facets:
description: The ordering of facets (widgets).
type: object
additionalProperties: false
properties:
order:
$ref: '#/order'

values:
description: The ordering of facet values, within an individual list.
type: object
additionalProperties:
$ref: '#/value'

value:
type: object
additionalProperties: false
properties:
order:
$ref: '#/order'
sortRemainingBy:
$ref: '#/sortRemainingBy'

order:
description: Pinned order of facet lists.
type: array
items:
type: string

sortRemainingBy:
description: >
How to display the remaining items.
- `count`: facet count (descending).
- `alpha`: alphabetical (ascending).
- `hidden`: show only pinned values.
type: string
enum: [count, alpha, hidden]
62 changes: 55 additions & 7 deletions specs/search/paths/rules/common/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,66 @@ params:
additionalProperties: false
properties:
query:
type: string
description: Query string.
$ref: '#/query'
automaticFacetFilters:
$ref: '#/automaticFacetFilters'
automaticOptionalFacetFilters:
$ref: '#/automaticOptionalFacetFilters'
renderingContent:
$ref: '../../../../common/schemas/IndexSettings.yml#/renderingContent'

query:
description: When providing a string, it replaces the entire query string. When providing an object, it describes incremental edits to be made to the query string (but you can't do both).
oneOf:
- $ref: '#/consequenceQuery'
- type: string

consequenceQuery:
type: object
additionalProperties: false
properties:
remove:
description: Words to remove.
type: array
description: Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
items:
$ref: '#/automaticFacetFilter'
automaticOptionalFacetFilters:
type: object
description: Same syntax as automaticFacetFilters, but the engine treats the filters as optional.
type: string
edits:
description: Edits to apply.
type: array
items:
$ref: '#/edit'

edit:
type: object
additionalProperties: false
properties:
type:
$ref: '#/editType'
delete:
description: Text or patterns to remove from the query string.
type: string
insert:
description: Text that should be inserted in place of the removed text inside the query string.
type: string

editType:
description: Type of edit.
type: string
enum: [remove, replace]

automaticFacetFilters:
description: Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern.
oneOf:
- type: array
items:
$ref: '#/automaticFacetFilter'
- type: array
items:
type: string

automaticOptionalFacetFilters:
description: Same syntax as automaticFacetFilters, but the engine treats the filters as optional.
$ref: '#/automaticFacetFilters'

automaticFacetFilter:
type: object
Expand Down
34 changes: 32 additions & 2 deletions tests/CTS/methods/requests/search/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,22 @@
],
"attributeCriteriaComputedByMinProximity": true,
"renderingContent": {
"string": "any"
"facetOrdering": {
"facets": {
"order": [
"a",
"b"
]
},
"values": {
"a": {
"order": [
"b"
],
"sortRemainingBy": "count"
}
}
}
},
"type": "default"
}
Expand Down Expand Up @@ -470,7 +485,22 @@
],
"attributeCriteriaComputedByMinProximity": true,
"renderingContent": {
"string": "any"
"facetOrdering": {
"facets": {
"order": [
"a",
"b"
]
},
"values": {
"a": {
"order": [
"b"
],
"sortRemainingBy": "count"
}
}
}
},
"type": "default"
}
Expand Down