Skip to content

Commit

Permalink
fix(specs): remove cross-specs references (#3412)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Jul 24, 2024
1 parent f643292 commit e3c6b84
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 112 deletions.
5 changes: 5 additions & 0 deletions specs/common/responses/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,8 @@ updatedAtResponse:
$ref: '#/taskID'
updatedAt:
$ref: '#/updatedAt'

taskStatus:
type: string
enum: [published, notPublished]
description: Task status, `published` if the task is completed, `notPublished` otherwise.
87 changes: 87 additions & 0 deletions specs/common/schemas/Hit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
matchedGeoLocation:
type: object
properties:
lat:
type: number
format: double
description: Latitude of the matched location.
lng:
type: number
format: double
description: Longitude of the matched location.
distance:
type: integer
description: Distance between the matched location and the search location (in meters).

personalization:
type: object
properties:
filtersScore:
type: integer
description: The score of the filters.
rankingScore:
type: integer
description: The score of the ranking.
score:
type: integer
description: The score of the event.

rankingInfo:
type: object
description: Object with detailed information about the record's ranking.
additionalProperties: false
properties:
filters:
type: integer
minimum: 0
description: Whether a filter matched the query.
firstMatchedWord:
type: integer
minimum: 0
description: Position of the first matched word in the best matching attribute of the record.
geoDistance:
type: integer
minimum: 0
description: Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).
geoPrecision:
type: integer
minimum: 1
description: Precision used when computing the geo distance, in meters.
matchedGeoLocation:
$ref: '#/matchedGeoLocation'
personalization:
$ref: '#/personalization'
nbExactWords:
type: integer
minimum: 0
description: Number of exactly matched words.
nbTypos:
type: integer
minimum: 0
description: Number of typos encountered when matching the record.
promoted:
type: boolean
description: Whether the record was promoted by a rule.
proximityDistance:
type: integer
minimum: 0
description: Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0.
userScore:
type: integer
description: Overall ranking of the record, expressed as a single integer. This attribute is internal.
words:
type: integer
minimum: 1
description: Number of matched words.
promotedByReRanking:
type: boolean
description: Whether the record is re-ranked.
required:
- nbTypos
- firstMatchedWord
- geoDistance
- nbExactWords
- userScore

distinctSeqID:
type: integer
8 changes: 8 additions & 0 deletions specs/common/schemas/Rule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
context:
type: string
pattern: '[A-Za-z0-9_-]+'
description: |
An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter.
For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`.
A rule context must only contain alphanumeric characters.
example: mobile
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/RecommendRule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Condition:
filters:
$ref: '../../../common/schemas/SearchParams.yml#/filters'
context:
$ref: '../../../search/paths/rules/common/schemas.yml#/context'
$ref: '../../../common/schemas/Rule.yml#/context'

Consequence:
type: object
Expand Down
4 changes: 2 additions & 2 deletions specs/recommend/common/schemas/RecommendationsResponse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ recommendHit:
_snippetResult:
$ref: '../../../common/schemas/SnippetResult.yml#/snippetResultMap'
_rankingInfo:
$ref: '../../../search/common/schemas/Hit.yml#/rankingInfo'
$ref: '../../../common/schemas/Hit.yml#/rankingInfo'
_distinctSeqID:
$ref: '../../../search/common/schemas/Hit.yml#/_distinctSeqID'
$ref: '../../../common/schemas/Hit.yml#/distinctSeqID'
_score:
$ref: '#/recommendScore'

Expand Down
2 changes: 1 addition & 1 deletion specs/recommend/paths/getRecommendStatus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ get:
additionalProperties: false
properties:
status:
$ref: '../../search/common/enums.yml#/taskStatus'
$ref: '../../common/responses/common.yml#/taskStatus'
required:
- status
'400':
Expand Down
5 changes: 0 additions & 5 deletions specs/search/common/enums.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,3 @@ logType:
type: string
enum: [all, query, build, error]
default: all

taskStatus:
type: string
enum: [published, notPublished]
description: Task status, `published` if the task is completed, `notPublished` otherwise.
93 changes: 2 additions & 91 deletions specs/search/common/schemas/Hit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,95 +16,6 @@ hit:
_snippetResult:
$ref: '../../../common/schemas/SnippetResult.yml#/snippetResultMap'
_rankingInfo:
$ref: '#/rankingInfo'
$ref: '../../../common/schemas/Hit.yml#/rankingInfo'
_distinctSeqID:
$ref: '#/_distinctSeqID'

# Props
_distinctSeqID:
type: integer

rankingInfo:
type: object
description: Object with detailed information about the record's ranking.
additionalProperties: false
properties:
filters:
type: integer
minimum: 0
description: Whether a filter matched the query.
firstMatchedWord:
type: integer
minimum: 0
description: Position of the first matched word in the best matching attribute of the record.
geoDistance:
type: integer
minimum: 0
description: Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).
geoPrecision:
type: integer
minimum: 1
description: Precision used when computing the geo distance, in meters.
matchedGeoLocation:
$ref: '#/matchedGeoLocation'
personalization:
$ref: '#/personalization'
nbExactWords:
type: integer
minimum: 0
description: Number of exactly matched words.
nbTypos:
type: integer
minimum: 0
description: Number of typos encountered when matching the record.
promoted:
type: boolean
description: Whether the record was promoted by a rule.
proximityDistance:
type: integer
minimum: 0
description: Number of words between multiple matches in the query plus 1. For single word queries, `proximityDistance` is 0.
userScore:
type: integer
description: Overall ranking of the record, expressed as a single integer. This attribute is internal.
words:
type: integer
minimum: 1
description: Number of matched words.
promotedByReRanking:
type: boolean
description: Whether the record is re-ranked.
required:
- nbTypos
- firstMatchedWord
- geoDistance
- nbExactWords
- userScore

matchedGeoLocation:
type: object
properties:
lat:
type: number
format: double
description: Latitude of the matched location.
lng:
type: number
format: double
description: Longitude of the matched location.
distance:
type: integer
description: Distance between the matched location and the search location (in meters).

personalization:
type: object
properties:
filtersScore:
type: integer
description: The score of the filters.
rankingScore:
type: integer
description: The score of the ranking.
score:
type: integer
description: The score of the event.
$ref: '../../../common/schemas/Hit.yml#/distinctSeqID'
2 changes: 1 addition & 1 deletion specs/search/paths/advanced/getAppTask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ get:
additionalProperties: false
properties:
status:
$ref: '../../common/enums.yml#/taskStatus'
$ref: '../../../common/responses/common.yml#/taskStatus'
required:
- status
'400':
Expand Down
2 changes: 1 addition & 1 deletion specs/search/paths/advanced/getTask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ get:
additionalProperties: false
properties:
status:
$ref: '../../common/enums.yml#/taskStatus'
$ref: '../../../common/responses/common.yml#/taskStatus'
required:
- status
'400':
Expand Down
11 changes: 1 addition & 10 deletions specs/search/paths/rules/common/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ condition:
description: Whether the pattern should match plurals, synonyms, and typos.
default: false
context:
$ref: '#/context'
$ref: '../../../../common/schemas/Rule.yml#/context'
filters:
type: string
description: |
Expand All @@ -77,15 +77,6 @@ anchoring:
Empty queries are only allowed as pattern with `anchoring: is`.
enum: [is, startsWith, endsWith, contains]

context:
type: string
pattern: '[A-Za-z0-9_-]+'
description: |
An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter.
For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`.
A rule context must only contain alphanumeric characters.
example: mobile

consequence:
type: object
description: |
Expand Down

0 comments on commit e3c6b84

Please sign in to comment.