diff --git a/.eslintrc.js b/.eslintrc.js index 1c753ed834f..43bd9f59f53 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { { files: ['*.yml'], parser: 'yaml-eslint-parser', + plugins: ["automation-custom"], rules: { '@typescript-eslint/naming-convention': 0, 'yml/quotes': [ @@ -31,10 +32,14 @@ module.exports = { }, ], 'yml/require-string-key': 2, - - // Should be removed once the specs are finished - 'yml/no-empty-document': 0, }, + overrides: [{ + files: ['specs/**/*.yml'], + rules: { + "automation-custom/description-dot": "error", + } + } + ] }, ], diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index df70ae2ec89..3755cc055d8 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -66,6 +66,9 @@ jobs: - name: Test scripts run: yarn scripts:test + - name: Test custom eslint plugin + run: yarn workspace eslint-plugin-automation-custom test + specs: runs-on: ubuntu-20.04 timeout-minutes: 10 diff --git a/eslint/jest.config.ts b/eslint/jest.config.ts new file mode 100644 index 00000000000..d2cc09a6727 --- /dev/null +++ b/eslint/jest.config.ts @@ -0,0 +1,8 @@ +import type { Config } from '@jest/types'; + +const config: Config.InitialOptions = { + preset: 'ts-jest', + testEnvironment: 'node', +}; + +export default config; diff --git a/eslint/package.json b/eslint/package.json new file mode 100644 index 00000000000..b71a51b61de --- /dev/null +++ b/eslint/package.json @@ -0,0 +1,22 @@ +{ + "name": "eslint-plugin-automation-custom", + "version": "1.0.0", + "description": "Custom rules for eslint", + "packageManager": "yarn@3.1.1", + "main": "dist/index.js", + "files": [ + "src/**.ts" + ], + "scripts": { + "build": "tsc", + "test": "jest" + }, + "devDependencies": { + "@types/jest": "27.4.1", + "eslint": "8.11.0", + "jest": "27.5.1", + "ts-jest": "27.1.3", + "ts-node": "10.7.0", + "typescript": "4.5.4" + } +} diff --git a/eslint/src/index.ts b/eslint/src/index.ts new file mode 100644 index 00000000000..c2679281ec7 --- /dev/null +++ b/eslint/src/index.ts @@ -0,0 +1,7 @@ +import { descriptionDot } from './rules/descriptionDot'; + +const rules = { + 'description-dot': descriptionDot, +}; + +export { rules }; diff --git a/eslint/src/rules/descriptionDot.ts b/eslint/src/rules/descriptionDot.ts new file mode 100644 index 00000000000..0fe438c6af8 --- /dev/null +++ b/eslint/src/rules/descriptionDot.ts @@ -0,0 +1,60 @@ +/* eslint-disable no-console */ +import type { Rule } from 'eslint'; + +import { isBLockScalar, isPairWithKey, isScalar } from '../utils'; + +export const descriptionDot: Rule.RuleModule = { + meta: { + docs: { + description: 'description must end with a dot', + }, + messages: { + descriptionNoDot: 'description does not end with a dot', + }, + fixable: 'code', + }, + create(context) { + if (!context.parserServices.isYAML) { + return {}; + } + + return { + YAMLPair(node): void { + if (!isPairWithKey(node, 'description')) { + return; + } + if (!isScalar(node.value)) { + return; + } + const value = node.value; + if ( + typeof value.value !== 'string' || + value.value.trim().endsWith('.') || + !value.value.trim().includes(' ') + ) { + // The rule is respected if: + // the description is not a string + // or it ends with a dot + // or it's a single word (like 'OK' or 'Success', it's not a sentence) + return; + } + + // trim the whitespaces at the end before adding the dot. This assume the indent is 2 + let toTrim = value.value.length - value.value.trimEnd().length; + if (isBLockScalar(value)) { + toTrim += node.key!.loc.start.column + 2; + } + context.report({ + node: node as any, + messageId: 'descriptionNoDot', + fix(fixer) { + return fixer.insertTextAfterRange( + [0, value.range[1] - toTrim], + '.' + ); + }, + }); + }, + }; + }, +}; diff --git a/eslint/src/utils.ts b/eslint/src/utils.ts new file mode 100644 index 00000000000..c11865fd34f --- /dev/null +++ b/eslint/src/utils.ts @@ -0,0 +1,20 @@ +import type { AST } from 'yaml-eslint-parser'; + +export function isScalar(node: AST.YAMLNode | null): node is AST.YAMLScalar { + return node !== null && node.type === 'YAMLScalar'; +} + +export function isBLockScalar( + node: AST.YAMLNode | null +): node is AST.YAMLBlockFoldedScalar | AST.YAMLBlockLiteralScalar { + return isScalar(node) && 'chomping' in node; +} + +export function isPairWithKey( + node: AST.YAMLNode | null, + key: string +): node is AST.YAMLPair { + if (node === null || node.type !== 'YAMLPair' || node.key === null) + return false; + return isScalar(node.key) && node.key.value === key; +} diff --git a/eslint/tests/descriptionDot.test.ts b/eslint/tests/descriptionDot.test.ts new file mode 100644 index 00000000000..9db33231590 --- /dev/null +++ b/eslint/tests/descriptionDot.test.ts @@ -0,0 +1,63 @@ +import { RuleTester } from 'eslint'; + +import { descriptionDot } from '../src/rules/descriptionDot'; + +const ruleTester = new RuleTester({ + parser: require.resolve('yaml-eslint-parser'), +}); + +ruleTester.run('description-dot', descriptionDot, { + valid: [ + ` +simple: + type: number + description: a number. + `, + ` +multi: + description: > + Creates a new A/B test with provided configuration. + + You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants. + `, + ` +multiStrip: + description: >- + Multiline comment + on description. + `, + ` +responses: + '200': + description: OK + `, + ], + invalid: [ + { + code: ` +simple: + description: a number + `, + errors: [{ messageId: 'descriptionNoDot' }], + output: ` +simple: + description: a number. + `, + }, + { + code: ` +multi: + description: > + Multiline comment + on description + `, + errors: [{ messageId: 'descriptionNoDot' }], + output: ` +multi: + description: > + Multiline comment + on description. + `, + }, + ], +}); diff --git a/eslint/tsconfig.json b/eslint/tsconfig.json new file mode 100644 index 00000000000..407dfa3d79f --- /dev/null +++ b/eslint/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../config/base.tsconfig.json", + "compilerOptions": { + "outDir": "dist", + }, + "include": [ + "src/**/*.ts", + ], + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/package.json b/package.json index 33b82e95399..5e299862c1f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "playground/javascript/browser/", "scripts/", "tests/output/javascript", - "website/" + "website/", + "eslint" ], "scripts": { "cli": "yarn workspace scripts ts-node --transpile-only ./index.ts", @@ -19,6 +20,8 @@ "docker": "docker exec -it dev yarn cli $*", "github-actions:lint": "eslint --ext=yml .github/", "playground:browser": "yarn workspace javascript-browser-playground start", + "postinstall": "yarn workspace eslint-plugin-automation-custom build", + "build:eslint": "yarn workspace eslint-plugin-automation-custom build && yarn install", "release": "yarn workspace scripts createReleaseIssue", "scripts:lint": "eslint --ext=ts scripts/", "scripts:test": "yarn workspace scripts test", @@ -37,6 +40,7 @@ "eslint-config-algolia": "20.0.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-algolia": "2.0.0", + "eslint-plugin-automation-custom": "1.0.0", "eslint-plugin-eslint-comments": "3.2.0", "eslint-plugin-import": "2.25.4", "eslint-plugin-jsdoc": "37.9.7", diff --git a/specs/abtesting/spec.yml b/specs/abtesting/spec.yml index d9098cd5ac5..381a6d0c2ab 100644 --- a/specs/abtesting/spec.yml +++ b/specs/abtesting/spec.yml @@ -23,7 +23,7 @@ security: apiKey: [] tags: - name: abtesting - description: abtesting API reference + description: abtesting API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/analytics/spec.yml b/specs/analytics/spec.yml index 001569e3099..d43a21aa6c7 100644 --- a/specs/analytics/spec.yml +++ b/specs/analytics/spec.yml @@ -23,7 +23,7 @@ security: apiKey: [] tags: - name: analytics - description: Analytics API reference + description: Analytics API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/bundled/abtesting.yml b/specs/bundled/abtesting.yml index 665ef120839..9d8b2efcbf3 100644 --- a/specs/bundled/abtesting.yml +++ b/specs/bundled/abtesting.yml @@ -273,7 +273,7 @@ security: apiKey: [] tags: - name: abtesting - description: abtesting API reference + description: abtesting API reference. paths: /1{path}: get: diff --git a/specs/bundled/analytics.yml b/specs/bundled/analytics.yml index 727070008ec..c77cbaed431 100644 --- a/specs/bundled/analytics.yml +++ b/specs/bundled/analytics.yml @@ -442,7 +442,7 @@ security: apiKey: [] tags: - name: analytics - description: Analytics API reference + description: Analytics API reference. paths: /1{path}: get: diff --git a/specs/bundled/insights.yml b/specs/bundled/insights.yml index 4f05ab47707..0a02752e52c 100644 --- a/specs/bundled/insights.yml +++ b/specs/bundled/insights.yml @@ -81,7 +81,7 @@ security: apiKey: [] tags: - name: insights - description: Insights API reference + description: Insights API reference. paths: /1{path}: get: diff --git a/specs/bundled/personalization.yml b/specs/bundled/personalization.yml index 57913e9b42b..feba18b0222 100644 --- a/specs/bundled/personalization.yml +++ b/specs/bundled/personalization.yml @@ -149,7 +149,7 @@ security: apiKey: [] tags: - name: personalization - description: Personalization API reference + description: Personalization API reference. paths: /1{path}: get: @@ -297,7 +297,7 @@ paths: $ref: '#/components/schemas/userToken' lastEventAt: type: string - description: Date of last event update. (ISO-8601 format) + description: Date of last event update. (ISO-8601 format). scores: type: object description: The userToken scores. diff --git a/specs/bundled/predict.yml b/specs/bundled/predict.yml index 7db2ab8bc72..dbc9c4c0471 100644 --- a/specs/bundled/predict.yml +++ b/specs/bundled/predict.yml @@ -89,7 +89,7 @@ security: apiKey: [] tags: - name: predict - description: Predict API reference + description: Predict API reference. paths: /1{path}: get: @@ -227,7 +227,7 @@ paths: properties: modelsToRetrieve: type: array - description: List with model types for which to retrieve predictions + description: List with model types for which to retrieve predictions. items: type: string enum: @@ -262,7 +262,7 @@ paths: properties: funnel_stage: type: object - description: Prediction for the **funnel_stage** model + description: Prediction for the **funnel_stage** model. properties: value: type: array @@ -280,7 +280,7 @@ paths: type: string order_value: type: object - description: Prediction for the **order_value** model + description: Prediction for the **order_value** model. properties: value: type: number @@ -289,7 +289,7 @@ paths: type: string affinities: type: object - description: Prediction for the **affinities** model + description: Prediction for the **affinities** model. properties: value: type: array @@ -310,30 +310,30 @@ paths: properties: type: object title: properties - description: Properties for the user profile + description: Properties for the user profile. properties: raw: type: object - description: Raw user properties (key-value pairs) + description: Raw user properties (key-value pairs). computed: type: object - description: Computed user properties (key-value pairs) + description: Computed user properties (key-value pairs). custom: type: object - description: Custom user properties (key-value pairs) + description: Custom user properties (key-value pairs). segments: type: object title: segments - description: Segments that the user belongs to + description: Segments that the user belongs to. properties: computed: type: array - description: List of computed segments IDs + description: List of computed segments IDs. items: type: string custom: type: array - description: List of custom segments IDs + description: List of custom segments IDs. items: type: string '400': diff --git a/specs/bundled/query-suggestions.yml b/specs/bundled/query-suggestions.yml index 4221d622e47..6e1b6690ee9 100644 --- a/specs/bundled/query-suggestions.yml +++ b/specs/bundled/query-suggestions.yml @@ -94,10 +94,10 @@ components: properties: query: type: string - description: The suggestion you would like to add + description: The suggestion you would like to add. count: type: integer - description: The measure of the suggestion relative popularity + description: The measure of the suggestion relative popularity. external: type: array items: @@ -264,13 +264,13 @@ components: schema: $ref: '#/components/schemas/ErrorBase' StatusUnprocessableEntity: - description: Status unprocessable entity + description: Status unprocessable entity. content: application/json: schema: $ref: '#/components/schemas/ErrorBase' InternalError: - description: Internal error + description: Internal error. content: application/json: schema: @@ -308,7 +308,7 @@ security: apiKey: [] tags: - name: query-suggestions - description: Query Suggestions API reference + description: Query Suggestions API reference. paths: /1{path}: get: diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml index 0a36dcfc5a0..4a5555dc120 100644 --- a/specs/bundled/recommend.yml +++ b/specs/bundled/recommend.yml @@ -650,7 +650,7 @@ components: example: 20 nbPages: type: integer - description: Number of pages available for the current query + description: Number of pages available for the current query. example: 1 userData: type: object @@ -689,12 +689,12 @@ components: description: Whether the facet count is exhaustive or approximate. exhaustiveNbHits: type: boolean - description: Indicate if the nbHits count was exhaustive or approximate + description: Indicate if the nbHits count was exhaustive or approximate. exhaustiveTypo: type: boolean description: >- Indicate if the typo-tolerence search was exhaustive or approximate - (only included when typo-tolerance is enabled) + (only included when typo-tolerance is enabled). facets: type: object additionalProperties: @@ -747,7 +747,7 @@ components: type: integer description: >- The number of hits selected and sorted by the relevant sort - algorithm + algorithm. example: 20 page: $ref: '#/components/schemas/page' @@ -962,7 +962,7 @@ security: apiKey: [] tags: - name: recommend - description: Recommend API reference + description: Recommend API reference. paths: /1{path}: get: diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index 50a87ae95af..6407b2a5942 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -698,7 +698,7 @@ components: example: 20 nbPages: type: integer - description: Number of pages available for the current query + description: Number of pages available for the current query. example: 1 userData: type: object @@ -737,12 +737,12 @@ components: description: Whether the facet count is exhaustive or approximate. exhaustiveNbHits: type: boolean - description: Indicate if the nbHits count was exhaustive or approximate + description: Indicate if the nbHits count was exhaustive or approximate. exhaustiveTypo: type: boolean description: >- Indicate if the typo-tolerence search was exhaustive or approximate - (only included when typo-tolerance is enabled) + (only included when typo-tolerance is enabled). facets: type: object additionalProperties: @@ -795,7 +795,7 @@ components: type: integer description: >- The number of hits selected and sorted by the relevant sort - algorithm + algorithm. example: 20 page: $ref: '#/components/schemas/page' @@ -1175,7 +1175,7 @@ components: description: List of query words that will match the token. _highlightResult: type: object - description: Highlighted results + description: Highlighted results. additionalProperties: false properties: type: @@ -1326,7 +1326,7 @@ components: properties: pattern: type: string - description: Query pattern syntax + description: Query pattern syntax. anchoring: $ref: '#/components/schemas/anchoring' alternatives: @@ -1601,7 +1601,7 @@ components: type: object additionalProperties: false nullable: true - description: Custom entries for a dictionary + description: Custom entries for a dictionary. properties: nbCustomEntires: description: >- @@ -1727,7 +1727,7 @@ components: description: Number of bytes of the index binary file. lastBuildTimeS: type: integer - description: Last build time + description: Last build time. numberOfPendingTask: type: integer description: >- @@ -1889,7 +1889,7 @@ security: apiKey: [] tags: - name: search - description: Search API reference + description: Search API reference. paths: /1{path}: get: @@ -4138,7 +4138,7 @@ paths: - $ref: '#/components/parameters/IndexName' - name: taskID in: path - description: Unique identifier of an task. Numeric value (up to 64bits) + description: Unique identifier of an task. Numeric value (up to 64bits). required: true schema: type: integer diff --git a/specs/bundled/sources.yml b/specs/bundled/sources.yml index 70db879857c..62a3ad1e6d3 100644 --- a/specs/bundled/sources.yml +++ b/specs/bundled/sources.yml @@ -1,7 +1,7 @@ openapi: 3.0.2 info: title: Event & Records Connection API - description: API powering the ingestion of Events and Records + description: API powering the ingestion of Events and Records. version: 0.1.0 components: securitySchemes: @@ -97,7 +97,7 @@ security: apiKey: [] tags: - name: sources - description: Sources API reference + description: Sources API reference. paths: /1{path}: get: @@ -240,7 +240,7 @@ paths: - csv uniqueIDColumn: type: string - description: The name of the column that hold the unique identifier + description: The name of the column that hold the unique identifier. example: objectID input: type: object @@ -297,16 +297,16 @@ paths: properties: type: type: string - description: The product to target + description: The product to target. enum: - search indexName: type: string - description: The index name of the product + description: The index name of the product. example: my_index_name operation: type: string - description: The type of operation to execute + description: The type of operation to execute. enum: - replace responses: diff --git a/specs/common/responses/InternalError.yml b/specs/common/responses/InternalError.yml index d13873a8aae..61b49ca2a44 100644 --- a/specs/common/responses/InternalError.yml +++ b/specs/common/responses/InternalError.yml @@ -1,4 +1,4 @@ -description: Internal error +description: Internal error. content: application/json: schema: diff --git a/specs/common/responses/StatusUnprocessableEntity.yml b/specs/common/responses/StatusUnprocessableEntity.yml index 7025ba204de..c2e508ff89e 100644 --- a/specs/common/responses/StatusUnprocessableEntity.yml +++ b/specs/common/responses/StatusUnprocessableEntity.yml @@ -1,4 +1,4 @@ -description: Status unprocessable entity +description: Status unprocessable entity. content: application/json: schema: diff --git a/specs/insights/spec.yml b/specs/insights/spec.yml index 61ea23d5493..7f856853a4d 100644 --- a/specs/insights/spec.yml +++ b/specs/insights/spec.yml @@ -23,7 +23,7 @@ security: apiKey: [] tags: - name: insights - description: Insights API reference + description: Insights API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/personalization/paths/getUserTokenProfile.yml b/specs/personalization/paths/getUserTokenProfile.yml index dc74a135b2b..1c0a9406e1b 100644 --- a/specs/personalization/paths/getUserTokenProfile.yml +++ b/specs/personalization/paths/getUserTokenProfile.yml @@ -22,7 +22,7 @@ get: $ref: '../common/parameters.yml#/userToken' lastEventAt: type: string - description: Date of last event update. (ISO-8601 format) + description: Date of last event update. (ISO-8601 format). scores: type: object description: The userToken scores. diff --git a/specs/personalization/spec.yml b/specs/personalization/spec.yml index c2371e66939..87d7e8cab72 100644 --- a/specs/personalization/spec.yml +++ b/specs/personalization/spec.yml @@ -22,7 +22,7 @@ security: apiKey: [] tags: - name: personalization - description: Personalization API reference + description: Personalization API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/predict/paths/fetchUserProfile.yml b/specs/predict/paths/fetchUserProfile.yml index 6b71a3eba64..6df63ff66fa 100644 --- a/specs/predict/paths/fetchUserProfile.yml +++ b/specs/predict/paths/fetchUserProfile.yml @@ -16,7 +16,7 @@ post: properties: modelsToRetrieve: type: array - description: List with model types for which to retrieve predictions + description: List with model types for which to retrieve predictions. items: type: string enum: @@ -51,7 +51,7 @@ post: properties: funnel_stage: type: object - description: Prediction for the **funnel_stage** model + description: Prediction for the **funnel_stage** model. properties: value: type: array @@ -69,7 +69,7 @@ post: type: string order_value: type: object - description: Prediction for the **order_value** model + description: Prediction for the **order_value** model. properties: value: type: number @@ -78,7 +78,7 @@ post: type: string affinities: type: object - description: Prediction for the **affinities** model + description: Prediction for the **affinities** model. properties: value: type: array @@ -99,30 +99,30 @@ post: properties: type: object title: properties - description: Properties for the user profile + description: Properties for the user profile. properties: raw: type: object - description: Raw user properties (key-value pairs) + description: Raw user properties (key-value pairs). computed: type: object - description: Computed user properties (key-value pairs) + description: Computed user properties (key-value pairs). custom: type: object - description: Custom user properties (key-value pairs) + description: Custom user properties (key-value pairs). segments: type: object title: segments - description: Segments that the user belongs to + description: Segments that the user belongs to. properties: computed: type: array - description: List of computed segments IDs + description: List of computed segments IDs. items: type: string custom: type: array - description: List of custom segments IDs + description: List of custom segments IDs. items: type: string '404': diff --git a/specs/predict/spec.yml b/specs/predict/spec.yml index f00e0e3c15d..c96fe4adc8a 100644 --- a/specs/predict/spec.yml +++ b/specs/predict/spec.yml @@ -16,7 +16,7 @@ security: apiKey: [] tags: - name: predict - description: Predict API reference + description: Predict API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/query-suggestions/common/parameters.yml b/specs/query-suggestions/common/parameters.yml index 5154a10b34a..884a80458f8 100644 --- a/specs/query-suggestions/common/parameters.yml +++ b/specs/query-suggestions/common/parameters.yml @@ -28,10 +28,10 @@ SourceIndexExternal: properties: query: type: string - description: The suggestion you would like to add + description: The suggestion you would like to add. count: type: integer - description: The measure of the suggestion relative popularity + description: The measure of the suggestion relative popularity. SourceIndices: type: array diff --git a/specs/query-suggestions/spec.yml b/specs/query-suggestions/spec.yml index 947381045f5..a221090d43a 100644 --- a/specs/query-suggestions/spec.yml +++ b/specs/query-suggestions/spec.yml @@ -22,7 +22,7 @@ security: apiKey: [] tags: - name: query-suggestions - description: Query Suggestions API reference + description: Query Suggestions API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/recommend/spec.yml b/specs/recommend/spec.yml index 4a657d6775d..b3514b36e8c 100644 --- a/specs/recommend/spec.yml +++ b/specs/recommend/spec.yml @@ -35,7 +35,7 @@ security: apiKey: [] tags: - name: recommend - description: Recommend API reference + description: Recommend API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/search/common/schemas/RequestOptions.yml b/specs/search/common/schemas/RequestOptions.yml deleted file mode 100644 index c47a3accd3b..00000000000 --- a/specs/search/common/schemas/RequestOptions.yml +++ /dev/null @@ -1,21 +0,0 @@ -# timeouts: -# type: object -# additionalProperties: false -# properties: -# connect: -# type: integer -# description: Connection timeout in seconds. -# example: 2 -# read: -# type: integer -# description: Read timeout in seconds. -# example: 5 -# write: -# type: integer -# description: Write timeout in seconds. -# example: 30 - -# X-Algolia-UserToken: -# type: string -# X-Forwarded-For: -# type: string diff --git a/specs/search/common/schemas/SearchResponse.yml b/specs/search/common/schemas/SearchResponse.yml index 3acd1a8c0c3..0a02cb5c7ce 100644 --- a/specs/search/common/schemas/SearchResponse.yml +++ b/specs/search/common/schemas/SearchResponse.yml @@ -58,10 +58,10 @@ baseSearchResponse: description: Whether the facet count is exhaustive or approximate. exhaustiveNbHits: type: boolean - description: Indicate if the nbHits count was exhaustive or approximate + description: Indicate if the nbHits count was exhaustive or approximate. exhaustiveTypo: type: boolean - description: Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + description: Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled). facets: type: object additionalProperties: @@ -110,7 +110,7 @@ baseSearchResponse: $ref: '#/nbPages' nbSortedHits: type: integer - description: The number of hits selected and sorted by the relevant sort algorithm + description: The number of hits selected and sorted by the relevant sort algorithm. example: 20 page: $ref: '../../../common/schemas/SearchParams.yml#/page' @@ -143,5 +143,5 @@ nbHits: nbPages: type: integer - description: Number of pages available for the current query + description: Number of pages available for the current query. example: 1 diff --git a/specs/search/common/schemas/listIndicesResponse.yml b/specs/search/common/schemas/listIndicesResponse.yml index f28c0163e89..1a9b477804a 100644 --- a/specs/search/common/schemas/listIndicesResponse.yml +++ b/specs/search/common/schemas/listIndicesResponse.yml @@ -35,7 +35,7 @@ indice: description: Number of bytes of the index binary file. lastBuildTimeS: type: integer - description: Last build time + description: Last build time. numberOfPendingTask: type: integer description: Number of pending indexing operations. This value is deprecated and should not be used. diff --git a/specs/search/paths/advanced/getTask.yml b/specs/search/paths/advanced/getTask.yml index 9f339e133af..c5640fbad99 100644 --- a/specs/search/paths/advanced/getTask.yml +++ b/specs/search/paths/advanced/getTask.yml @@ -6,7 +6,7 @@ get: - $ref: '../../../common/parameters.yml#/IndexName' - name: taskID in: path - description: Unique identifier of an task. Numeric value (up to 64bits) + description: Unique identifier of an task. Numeric value (up to 64bits). required: true schema: type: integer diff --git a/specs/search/paths/dictionaries/common/schemas/Languages.yml b/specs/search/paths/dictionaries/common/schemas/Languages.yml index 0f633a16aaf..4a6fdd31e40 100644 --- a/specs/search/paths/dictionaries/common/schemas/Languages.yml +++ b/specs/search/paths/dictionaries/common/schemas/Languages.yml @@ -18,7 +18,7 @@ dictionaryLanguage: type: object additionalProperties: false nullable: true - description: Custom entries for a dictionary + description: Custom entries for a dictionary. properties: nbCustomEntires: description: "When nbCustomEntries is set to 0, the user didn't customize the dictionary. The dictionary is still supported with standard, Algolia-provided entries." diff --git a/specs/search/paths/rules/common/schemas.yml b/specs/search/paths/rules/common/schemas.yml index b284bb79cfd..aefa9fccba7 100644 --- a/specs/search/paths/rules/common/schemas.yml +++ b/specs/search/paths/rules/common/schemas.yml @@ -34,7 +34,7 @@ condition: properties: pattern: type: string - description: Query pattern syntax + description: Query pattern syntax. anchoring: $ref: '#/anchoring' alternatives: diff --git a/specs/search/paths/synonyms/common/schemas.yml b/specs/search/paths/synonyms/common/schemas.yml index 7bb05be90d3..579251076e7 100644 --- a/specs/search/paths/synonyms/common/schemas.yml +++ b/specs/search/paths/synonyms/common/schemas.yml @@ -41,7 +41,7 @@ synonymHit: description: List of query words that will match the token. _highlightResult: type: object - description: Highlighted results + description: Highlighted results. additionalProperties: false properties: type: diff --git a/specs/search/spec.yml b/specs/search/spec.yml index c55af8e9049..ef6f108477a 100644 --- a/specs/search/spec.yml +++ b/specs/search/spec.yml @@ -35,7 +35,7 @@ security: apiKey: [] tags: - name: search - description: Search API reference + description: Search API reference. paths: # ###################### # ### Custom request ### diff --git a/specs/sources/paths/ingest/postUrl.yml b/specs/sources/paths/ingest/postUrl.yml index cb57386c57b..542689a8771 100644 --- a/specs/sources/paths/ingest/postUrl.yml +++ b/specs/sources/paths/ingest/postUrl.yml @@ -23,7 +23,7 @@ post: - csv uniqueIDColumn: type: string - description: The name of the column that hold the unique identifier + description: The name of the column that hold the unique identifier. example: objectID input: type: object @@ -78,16 +78,16 @@ post: properties: type: type: string - description: The product to target + description: The product to target. enum: - search indexName: type: string - description: The index name of the product + description: The index name of the product. example: my_index_name operation: type: string - description: The type of operation to execute + description: The type of operation to execute. enum: - replace responses: diff --git a/specs/sources/spec.yml b/specs/sources/spec.yml index cba1ae6bd57..53a4e27304c 100644 --- a/specs/sources/spec.yml +++ b/specs/sources/spec.yml @@ -1,7 +1,7 @@ openapi: 3.0.2 info: title: Event & Records Connection API - description: API powering the ingestion of Events and Records + description: API powering the ingestion of Events and Records. version: 0.1.0 components: securitySchemes: @@ -22,7 +22,7 @@ security: apiKey: [] tags: - name: sources - description: Sources API reference + description: Sources API reference. paths: # ###################### # ### Custom request ### diff --git a/yarn.lock b/yarn.lock index 35ae76b128c..c4dba19d550 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,6 +18,7 @@ __metadata: eslint-config-algolia: 20.0.0 eslint-config-prettier: 8.5.0 eslint-plugin-algolia: 2.0.0 + eslint-plugin-automation-custom: 1.0.0 eslint-plugin-eslint-comments: 3.2.0 eslint-plugin-import: 2.25.4 eslint-plugin-jsdoc: 37.9.7 @@ -10077,6 +10078,19 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-automation-custom@1.0.0, eslint-plugin-automation-custom@workspace:eslint": + version: 0.0.0-use.local + resolution: "eslint-plugin-automation-custom@workspace:eslint" + dependencies: + "@types/jest": 27.4.1 + eslint: 8.11.0 + jest: 27.5.1 + ts-jest: 27.1.3 + ts-node: 10.7.0 + typescript: 4.5.4 + languageName: unknown + linkType: soft + "eslint-plugin-eslint-comments@npm:3.2.0": version: 3.2.0 resolution: "eslint-plugin-eslint-comments@npm:3.2.0" @@ -10233,6 +10247,51 @@ __metadata: languageName: node linkType: hard +"eslint@npm:8.11.0": + version: 8.11.0 + resolution: "eslint@npm:8.11.0" + dependencies: + "@eslint/eslintrc": ^1.2.1 + "@humanwhocodes/config-array": ^0.9.2 + ajv: ^6.10.0 + chalk: ^4.0.0 + cross-spawn: ^7.0.2 + debug: ^4.3.2 + doctrine: ^3.0.0 + escape-string-regexp: ^4.0.0 + eslint-scope: ^7.1.1 + eslint-utils: ^3.0.0 + eslint-visitor-keys: ^3.3.0 + espree: ^9.3.1 + esquery: ^1.4.0 + esutils: ^2.0.2 + fast-deep-equal: ^3.1.3 + file-entry-cache: ^6.0.1 + functional-red-black-tree: ^1.0.1 + glob-parent: ^6.0.1 + globals: ^13.6.0 + ignore: ^5.2.0 + import-fresh: ^3.0.0 + imurmurhash: ^0.1.4 + is-glob: ^4.0.0 + js-yaml: ^4.1.0 + json-stable-stringify-without-jsonify: ^1.0.1 + levn: ^0.4.1 + lodash.merge: ^4.6.2 + minimatch: ^3.0.4 + natural-compare: ^1.4.0 + optionator: ^0.9.1 + regexpp: ^3.2.0 + strip-ansi: ^6.0.1 + strip-json-comments: ^3.1.0 + text-table: ^0.2.0 + v8-compile-cache: ^2.0.3 + bin: + eslint: bin/eslint.js + checksum: a06a2ea37002d6c0a4f462fe31b4411185dc3da7857fafb896eb392ba95a1289cc3538056474b2f44f08012f265bede01a39d46df4ac39ebc6d7be90e2c8f9fa + languageName: node + linkType: hard + "eslint@npm:8.12.0": version: 8.12.0 resolution: "eslint@npm:8.12.0" @@ -20295,6 +20354,40 @@ __metadata: languageName: node linkType: hard +"ts-jest@npm:27.1.3": + version: 27.1.3 + resolution: "ts-jest@npm:27.1.3" + dependencies: + bs-logger: 0.x + fast-json-stable-stringify: 2.x + jest-util: ^27.0.0 + json5: 2.x + lodash.memoize: 4.x + make-error: 1.x + semver: 7.x + yargs-parser: 20.x + peerDependencies: + "@babel/core": ">=7.0.0-beta.0 <8" + "@types/jest": ^27.0.0 + babel-jest: ">=27.0.0 <28" + esbuild: ~0.14.0 + jest: ^27.0.0 + typescript: ">=3.8 <5.0" + peerDependenciesMeta: + "@babel/core": + optional: true + "@types/jest": + optional: true + babel-jest: + optional: true + esbuild: + optional: true + bin: + ts-jest: cli.js + checksum: eb54e5b8fc5f06e4cc20ecec7891201ddc78a3537d5eb3775e29ffbc7e83fd2a68f91db801b6a8c820c872060b24dc41fb6decac800b76256d3cdda6520b5c4f + languageName: node + linkType: hard + "ts-jest@npm:27.1.4": version: 27.1.4 resolution: "ts-jest@npm:27.1.4" @@ -20554,6 +20647,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:4.5.4": + version: 4.5.4 + resolution: "typescript@npm:4.5.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 59f3243f9cd6fe3161e6150ff6bf795fc843b4234a655dbd938a310515e0d61afd1ac942799e7415e4334255e41c2c49b7dd5d9fd38a17acd25a6779ca7e0961 + languageName: node + linkType: hard + "typescript@npm:4.6.3": version: 4.6.3 resolution: "typescript@npm:4.6.3" @@ -20564,6 +20667,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@4.5.4#~builtin": + version: 4.5.4 + resolution: "typescript@patch:typescript@npm%3A4.5.4#~builtin::version=4.5.4&hash=493e53" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 2e488dde7d2c4a2fa2e79cf2470600f8ce81bc0563c276b72df8ff412d74456ae532ba824650ae936ce207440c79720ddcfaa25e3cb4477572b8534fa4e34d49 + languageName: node + linkType: hard + "typescript@patch:typescript@4.6.3#~builtin": version: 4.6.3 resolution: "typescript@patch:typescript@npm%3A4.6.3#~builtin::version=4.6.3&hash=493e53"