From 0a8cf278a9498e912369c5d0634f91479d6a58ad Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 16:56:25 +0200 Subject: [PATCH 1/8] fix(specs): proper title with linter --- .eslintrc.cjs | 1 + eslint/src/index.ts | 2 + eslint/src/rules/outOfLineRule.ts | 23 +---- eslint/src/rules/validInlineTitle.ts | 93 +++++++++++++++++++ eslint/src/utils.ts | 14 +++ eslint/tests/validInlineTitle.test.ts | 83 +++++++++++++++++ specs/abtesting/common/parameters.yml | 2 + specs/analytics/common/parameters.yml | 3 + specs/analytics/common/schemas/getTopHits.yml | 6 +- .../common/schemas/getTopSearches.yml | 6 +- .../paths/click/getAddToCartRate.yml | 2 +- .../paths/click/getAverageClickPosition.yml | 2 +- .../paths/click/getClickThroughRate.yml | 2 +- .../paths/click/getConversionRate.yml | 2 +- .../analytics/paths/click/getPurchaseRate.yml | 2 +- specs/analytics/paths/revenue/getRevenue.yml | 2 +- .../analytics/paths/search/getNoClickRate.yml | 2 +- .../paths/search/getNoResultsRate.yml | 2 +- .../paths/search/getSearchesCount.yml | 2 +- .../paths/search/getSearchesNoClicks.yml | 2 +- .../paths/search/getSearchesNoResults.yml | 2 +- .../paths/search/getTopCountries.yml | 2 +- .../analytics/paths/search/getUsersCount.yml | 2 +- specs/common/responses/Forbidden.yml | 3 + specs/common/responses/InvalidRequest.yml | 3 + specs/common/responses/Success.yml | 2 +- specs/common/schemas/IndexSettings.yml | 1 - specs/common/schemas/SearchParams.yml | 3 +- specs/common/schemas/SearchResponse.yml | 5 +- specs/crawler/common/schemas/action.yml | 1 + .../crawler/common/schemas/configuration.yml | 4 +- .../schemas/crawlerConfigVersionsResponse.yml | 1 + .../common/schemas/crawlersResponse.yml | 1 + .../common/schemas/domainsResponse.yml | 1 + specs/crawler/common/schemas/responses.yml | 2 + specs/crawler/paths/crawler.yml | 1 + specs/crawler/paths/crawlerConfigVersion.yml | 1 + specs/crawler/paths/crawlerCrawl.yml | 1 + specs/crawler/paths/crawlerStats.yml | 1 + specs/crawler/paths/crawlerTask.yml | 1 + specs/crawler/paths/crawlerTest.yml | 5 + specs/crawler/paths/crawlers.yml | 2 + specs/crawler/paths/docsearch.yml | 1 + .../common/schemas/authentication.yml | 12 --- specs/ingestion/common/schemas/run.yml | 1 + specs/ingestion/common/schemas/source.yml | 8 -- specs/ingestion/common/schemas/task.yml | 8 +- .../common/schemas/transformation.yml | 1 + specs/insights/paths/pushEvents.yml | 2 +- .../common/responses/BadRequestResponse.yml | 1 + .../common/responses/ForbiddenResponse.yml | 1 + .../common/responses/IncidentsResponse.yml | 2 +- .../common/responses/IndexingResponse.yml | 3 +- .../InfrastructureAPIUnauthorized.yml | 1 + .../responses/InfrastructureResponse.yml | 3 +- .../common/responses/InventoryResponse.yml | 2 +- .../common/responses/LatencyResponse.yml | 3 +- .../common/responses/ReachabilityResponse.yml | 2 +- .../common/responses/StatusResponse.yml | 2 +- .../common/schemas/Configuration.yml | 5 +- .../paths/getConfigurationStatus.yml | 1 + specs/query-suggestions/paths/getLogFile.yml | 1 + .../common/schemas/RecommendRule.yml | 1 + .../recommend/paths/searchRecommendRules.yml | 2 +- .../schemas/SearchForFacetValuesResponse.yml | 2 +- specs/search/paths/advanced/getLogs.yml | 2 +- specs/search/paths/objects/getObjects.yml | 2 +- specs/search/paths/rules/searchRules.yml | 2 +- specs/usage/common/schemas/responses.yml | 2 + 69 files changed, 280 insertions(+), 91 deletions(-) create mode 100644 eslint/src/rules/validInlineTitle.ts create mode 100644 eslint/tests/validInlineTitle.test.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 4d2917c4278..3d973f1ae42 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -65,6 +65,7 @@ module.exports = { 'automation-custom/out-of-line-any-of': 'error', 'automation-custom/valid-acl': 'error', 'automation-custom/ref-common': 'error', + 'automation-custom/valid-inline-title': 'error', }, }, ], diff --git a/eslint/src/index.ts b/eslint/src/index.ts index d8cb7d868df..a948b747a8a 100644 --- a/eslint/src/index.ts +++ b/eslint/src/index.ts @@ -5,6 +5,7 @@ import { createOutOfLineRule } from './rules/outOfLineRule'; import { refCommon } from './rules/refCommon'; import { singleQuoteRef } from './rules/singleQuoteRef'; import { validACL } from './rules/validACL'; +import { validInlineTitle } from './rules/validInlineTitle'; const rules = { 'end-with-dot': endWithDot, @@ -17,6 +18,7 @@ const rules = { 'valid-acl': validACL, 'no-new-line': noNewLine, 'ref-common': refCommon, + 'valid-inline-title': validInlineTitle, }; // Custom parser for ESLint, to read plain text file like mustache. diff --git a/eslint/src/rules/outOfLineRule.ts b/eslint/src/rules/outOfLineRule.ts index a8a0c365cd7..da582932e41 100644 --- a/eslint/src/rules/outOfLineRule.ts +++ b/eslint/src/rules/outOfLineRule.ts @@ -1,13 +1,6 @@ import type { Rule } from 'eslint'; -import type { AST } from 'yaml-eslint-parser'; -import { - isBlockScalar, - isMapping, - isPairWithKey, - isScalar, - isSequence, -} from '../utils'; +import { isNullable, isPairWithKey } from '../utils'; export function createOutOfLineRule({ property, @@ -74,17 +67,3 @@ export function createOutOfLineRule({ }; return rule; } - -function isNullable(node: AST.YAMLNode | null): boolean { - return ( - isSequence(node) && - node.entries.some( - (entry) => - isMapping(entry) && - isPairWithKey(entry.pairs[0], 'type') && - isScalar(entry.pairs[0].value) && - !isBlockScalar(entry.pairs[0].value) && - entry.pairs[0].value.raw === "'null'" - ) - ); -} diff --git a/eslint/src/rules/validInlineTitle.ts b/eslint/src/rules/validInlineTitle.ts new file mode 100644 index 00000000000..5c70b5fb246 --- /dev/null +++ b/eslint/src/rules/validInlineTitle.ts @@ -0,0 +1,93 @@ +import type { Rule } from 'eslint'; + +import { isNullable, isPairWithKey } from '../utils'; + +export const validInlineTitle: Rule.RuleModule = { + meta: { + docs: { + description: + 'title must be set in inline models, should be the first property and start with a lowercase', + }, + messages: { + validInlineTitle: + 'title must be set in inline models, should be the first property and start with a lowercase', + }, + }, + create(context) { + if (!context.sourceCode.parserServices.isYAML) { + return {}; + } + + return { + YAMLPair(node): void { + if ( + !isPairWithKey(node, 'type') || + node.value?.type !== 'YAMLScalar' || + node.value.value !== 'object' + ) { + return; + } + + // we don't enforce it for root level object + if (node.parent.parent.loc.start.column === 0) { + return; + } + + // make sure title starts with a lowercase + const title = node.parent.pairs.find((pair) => + isPairWithKey(pair, 'title') + ); + const titleNode = title?.value; + if ( + titleNode && + (titleNode.type !== 'YAMLScalar' || + !/^[a-z]/.test(titleNode.value as string)) + ) { + context.report({ + node: title, + messageId: 'validInlineTitle', + }); + } + + // if there are no properties, we don't need a title + const properties = node.parent.pairs.find((pair) => + isPairWithKey(pair, 'properties') + ); + if (!properties) { + return; + } + + // allow it on nullable objects + if ( + isPairWithKey(node.parent.parent.parent, 'oneOf') && + isNullable(node.parent.parent.parent.value) + ) { + return; + } + + // allow on allOf too, since they are not generated + if (isPairWithKey(node.parent.parent.parent, 'allOf')) { + return; + } + + // make sure the title is set on the same object + if (!title) { + context.report({ + node: node.value, + messageId: 'validInlineTitle', + }); + + return; + } + + // make sure title is the first property + if (!isPairWithKey(node.parent.pairs[0], 'title')) { + context.report({ + node: title, + messageId: 'validInlineTitle', + }); + } + }, + }; + }, +}; diff --git a/eslint/src/utils.ts b/eslint/src/utils.ts index 2bd3257bbdd..82d70388259 100644 --- a/eslint/src/utils.ts +++ b/eslint/src/utils.ts @@ -29,3 +29,17 @@ export function isPairWithKey( return false; return isScalar(node.key) && node.key.value === key; } + +export function isNullable(node: AST.YAMLNode | null): boolean { + return ( + isSequence(node) && + node.entries.some( + (entry) => + isMapping(entry) && + isPairWithKey(entry.pairs[0], 'type') && + isScalar(entry.pairs[0].value) && + !isBlockScalar(entry.pairs[0].value) && + entry.pairs[0].value.raw === "'null'" + ) + ); +} diff --git a/eslint/tests/validInlineTitle.test.ts b/eslint/tests/validInlineTitle.test.ts new file mode 100644 index 00000000000..a8635dc3815 --- /dev/null +++ b/eslint/tests/validInlineTitle.test.ts @@ -0,0 +1,83 @@ +import { RuleTester } from 'eslint'; + +import { validInlineTitle } from '../src/rules/validInlineTitle'; + +const ruleTester = new RuleTester({ + parser: require.resolve('yaml-eslint-parser'), +}); + +ruleTester.run('valid-inline-title', validInlineTitle, { + valid: [ + ` +currencies: + type: object + properties: + inner: + type: object + `, + ` +currencies: + type: object + properties: + inner: + title: currency + type: object + properties: + currency: + type: string + title: Currency + `, + ` +dictionaryLanguage: + oneOf: + - type: object + properties: + prop: + type: integer + - type: 'null' + `, + ], + invalid: [ + { + code: ` +currencies: + type: object + properties: + inner: + type: object + properties: + currency: + type: string + title: Currency + `, + errors: [{ messageId: 'validInlineTitle' }], + }, + { + code: ` +currencies: + type: object + properties: + inner: + type: object + title: currency + properties: + currency: + type: string + title: Currency + `, + errors: [{ messageId: 'validInlineTitle' }], + }, + { + code: ` +currencies: + title: UpperCaseFine + type: object + properties: + inner: + title: UpperCaseNotFine + type: object + `, + errors: [{ messageId: 'validInlineTitle' }], + }, + ], +}); diff --git a/specs/abtesting/common/parameters.yml b/specs/abtesting/common/parameters.yml index e2d6200d315..2aa1557ce8d 100644 --- a/specs/abtesting/common/parameters.yml +++ b/specs/abtesting/common/parameters.yml @@ -96,6 +96,7 @@ filterEffects: description: A/B test filter effects resulting from configuration settings. properties: outliers: + title: outliersFilter type: object description: Outliers removed from the A/B test as a result of configuration settings. example: @@ -111,6 +112,7 @@ filterEffects: description: Number of tracked searches removed from the A/B test. example: 237 emptySearch: + title: emptySearchFilter type: object description: Empty searches removed from the A/B test as a result of configuration settings. example: diff --git a/specs/analytics/common/parameters.yml b/specs/analytics/common/parameters.yml index 3beb43443b8..d35e7a0800d 100644 --- a/specs/analytics/common/parameters.yml +++ b/specs/analytics/common/parameters.yml @@ -117,6 +117,7 @@ clickPositions: minItems: 12 maxItems: 12 items: + title: clickPosition type: object description: Click position. properties: @@ -242,10 +243,12 @@ purchaseCount: example: 10 currencies: + title: currencies type: object description: Revenue associated with this search, broken-down by currencies. default: {} additionalProperties: + title: currencyCode x-additionalPropertiesName: currency type: object description: Currency code. diff --git a/specs/analytics/common/schemas/getTopHits.yml b/specs/analytics/common/schemas/getTopHits.yml index bca8bccfe7d..b7d8fe50d88 100644 --- a/specs/analytics/common/schemas/getTopHits.yml +++ b/specs/analytics/common/schemas/getTopHits.yml @@ -9,8 +9,8 @@ topHitsResponse: type: array description: Most frequent search results. items: - type: object title: topHit + type: object additionalProperties: false required: - hit @@ -32,8 +32,8 @@ topHitsResponseWithAnalytics: type: array description: Most frequent search results with click and conversion metrics. items: - type: object title: topHitWithAnalytics + type: object additionalProperties: false required: - hit @@ -70,8 +70,8 @@ topHitsResponseWithRevenueAnalytics: type: array description: Most frequent search results with click, conversion, and revenue metrics. items: - type: object title: topHitWithRevenueAnalytics + type: object additionalProperties: false required: - hit diff --git a/specs/analytics/common/schemas/getTopSearches.yml b/specs/analytics/common/schemas/getTopSearches.yml index cd9570a2645..35f9419c960 100644 --- a/specs/analytics/common/schemas/getTopSearches.yml +++ b/specs/analytics/common/schemas/getTopSearches.yml @@ -9,8 +9,8 @@ topSearchesResponse: type: array description: Most popular searches and their number of search results (hits). items: - type: object title: topSearch + type: object additionalProperties: false required: - search @@ -35,8 +35,8 @@ topSearchesResponseWithAnalytics: type: array description: Most popular searches and their associated click and conversion metrics. items: - type: object title: topSearchWithAnalytics + type: object additionalProperties: false required: - search @@ -82,8 +82,8 @@ topSearchesResponseWithRevenueAnalytics: type: array description: Most popular searches, including their click and revenue metrics. items: - type: object title: topSearchWithRevenueAnalytics + type: object additionalProperties: false required: - search diff --git a/specs/analytics/paths/click/getAddToCartRate.yml b/specs/analytics/paths/click/getAddToCartRate.yml index ef40031ac8b..483b3e4831c 100644 --- a/specs/analytics/paths/click/getAddToCartRate.yml +++ b/specs/analytics/paths/click/getAddToCartRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily add-to-cart rates. items: - type: object title: dailyAddToCartRates + type: object additionalProperties: false required: - rate diff --git a/specs/analytics/paths/click/getAverageClickPosition.yml b/specs/analytics/paths/click/getAverageClickPosition.yml index 7c5295368f9..5949bcc68e0 100644 --- a/specs/analytics/paths/click/getAverageClickPosition.yml +++ b/specs/analytics/paths/click/getAverageClickPosition.yml @@ -45,8 +45,8 @@ get: type: array description: Daily average click positions. items: - type: object title: dailyAverageClicks + type: object additionalProperties: false required: - average diff --git a/specs/analytics/paths/click/getClickThroughRate.yml b/specs/analytics/paths/click/getClickThroughRate.yml index cbff729ceff..07ee4ce35ec 100644 --- a/specs/analytics/paths/click/getClickThroughRate.yml +++ b/specs/analytics/paths/click/getClickThroughRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily click-through rates. items: - type: object title: dailyClickThroughRates + type: object additionalProperties: false required: - rate diff --git a/specs/analytics/paths/click/getConversionRate.yml b/specs/analytics/paths/click/getConversionRate.yml index cdb804eec97..bc269f3f50a 100644 --- a/specs/analytics/paths/click/getConversionRate.yml +++ b/specs/analytics/paths/click/getConversionRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily conversion rates. items: - type: object title: dailyConversionRates + type: object additionalProperties: false required: - rate diff --git a/specs/analytics/paths/click/getPurchaseRate.yml b/specs/analytics/paths/click/getPurchaseRate.yml index a7ac4da8735..b1fd6a53245 100644 --- a/specs/analytics/paths/click/getPurchaseRate.yml +++ b/specs/analytics/paths/click/getPurchaseRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily purchase rates. items: - type: object title: dailyPurchaseRates + type: object additionalProperties: false required: - rate diff --git a/specs/analytics/paths/revenue/getRevenue.yml b/specs/analytics/paths/revenue/getRevenue.yml index ecf60e889b9..29f1326a2c4 100644 --- a/specs/analytics/paths/revenue/getRevenue.yml +++ b/specs/analytics/paths/revenue/getRevenue.yml @@ -34,8 +34,8 @@ get: type: array description: Daily revenue. items: - type: object title: dailyRevenue + type: object additionalProperties: false required: - currencies diff --git a/specs/analytics/paths/search/getNoClickRate.yml b/specs/analytics/paths/search/getNoClickRate.yml index 2c761ef00f6..3658e28ac35 100644 --- a/specs/analytics/paths/search/getNoClickRate.yml +++ b/specs/analytics/paths/search/getNoClickRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily no click rates. items: - type: object title: dailyNoClickRates + type: object additionalProperties: false required: - rate diff --git a/specs/analytics/paths/search/getNoResultsRate.yml b/specs/analytics/paths/search/getNoResultsRate.yml index bbc775a8461..6308781c9a1 100644 --- a/specs/analytics/paths/search/getNoResultsRate.yml +++ b/specs/analytics/paths/search/getNoResultsRate.yml @@ -46,8 +46,8 @@ get: type: array description: Daily no results rates. items: - type: object title: dailyNoResultsRates + type: object additionalProperties: false required: - date diff --git a/specs/analytics/paths/search/getSearchesCount.yml b/specs/analytics/paths/search/getSearchesCount.yml index 108ef3f632a..95f934dd06e 100644 --- a/specs/analytics/paths/search/getSearchesCount.yml +++ b/specs/analytics/paths/search/getSearchesCount.yml @@ -40,8 +40,8 @@ get: type: array description: Daily number of searches. items: - type: object title: dailySearches + type: object additionalProperties: false required: - date diff --git a/specs/analytics/paths/search/getSearchesNoClicks.yml b/specs/analytics/paths/search/getSearchesNoClicks.yml index 97c190d50fc..6eab10666b9 100644 --- a/specs/analytics/paths/search/getSearchesNoClicks.yml +++ b/specs/analytics/paths/search/getSearchesNoClicks.yml @@ -36,8 +36,8 @@ get: type: array description: Searches without any clicks. items: - type: object title: dailySearchesNoClicks + type: object additionalProperties: false required: - search diff --git a/specs/analytics/paths/search/getSearchesNoResults.yml b/specs/analytics/paths/search/getSearchesNoResults.yml index 9078b731222..337b8fa51be 100644 --- a/specs/analytics/paths/search/getSearchesNoResults.yml +++ b/specs/analytics/paths/search/getSearchesNoResults.yml @@ -36,8 +36,8 @@ get: type: array description: Searches without results. items: - type: object title: dailySearchesNoResults + type: object additionalProperties: false required: - search diff --git a/specs/analytics/paths/search/getTopCountries.yml b/specs/analytics/paths/search/getTopCountries.yml index ae5d8465822..ea01d476e49 100644 --- a/specs/analytics/paths/search/getTopCountries.yml +++ b/specs/analytics/paths/search/getTopCountries.yml @@ -36,8 +36,8 @@ get: type: array description: Countries and number of searches. items: - type: object title: topCountry + type: object additionalProperties: false required: - country diff --git a/specs/analytics/paths/search/getUsersCount.yml b/specs/analytics/paths/search/getUsersCount.yml index 9fe50b10665..857a7e1efa1 100644 --- a/specs/analytics/paths/search/getUsersCount.yml +++ b/specs/analytics/paths/search/getUsersCount.yml @@ -48,8 +48,8 @@ get: type: array description: Daily number of unique users. items: - type: object title: dailyUsers + type: object additionalProperties: false required: - date diff --git a/specs/common/responses/Forbidden.yml b/specs/common/responses/Forbidden.yml index ff5c14b4d76..60a2ee68c2b 100644 --- a/specs/common/responses/Forbidden.yml +++ b/specs/common/responses/Forbidden.yml @@ -2,9 +2,11 @@ description: Invalid credentials. content: application/json: schema: + title: forbidden type: object properties: error: + title: forbiddenError type: object properties: code: @@ -14,6 +16,7 @@ content: errors: type: array items: + title: errorItem type: object properties: code: diff --git a/specs/common/responses/InvalidRequest.yml b/specs/common/responses/InvalidRequest.yml index fc5285c1d45..292438097e1 100644 --- a/specs/common/responses/InvalidRequest.yml +++ b/specs/common/responses/InvalidRequest.yml @@ -2,9 +2,11 @@ description: Invalid request. content: application/json: schema: + title: invalidRequest type: object properties: error: + title: invalidRequestError type: object properties: code: @@ -14,6 +16,7 @@ content: errors: type: array items: + title: errorItem type: object properties: code: diff --git a/specs/common/responses/Success.yml b/specs/common/responses/Success.yml index 94cafe90aee..0f1b8edd684 100644 --- a/specs/common/responses/Success.yml +++ b/specs/common/responses/Success.yml @@ -2,8 +2,8 @@ description: Success content: application/json: schema: + title: successResponse type: object - title: SuccessResponse additionalProperties: false required: - status diff --git a/specs/common/schemas/IndexSettings.yml b/specs/common/schemas/IndexSettings.yml index a95f3b37ee9..5383e41d500 100644 --- a/specs/common/schemas/IndexSettings.yml +++ b/specs/common/schemas/IndexSettings.yml @@ -6,7 +6,6 @@ indexSettings: baseIndexSettings: type: object - title: Index settings. additionalProperties: false properties: attributesForFaceting: diff --git a/specs/common/schemas/SearchParams.yml b/specs/common/schemas/SearchParams.yml index 9fd9b70efd8..77797f04053 100644 --- a/specs/common/schemas/SearchParams.yml +++ b/specs/common/schemas/SearchParams.yml @@ -221,7 +221,7 @@ baseSearchParamsWithoutQuery: searchParamsString: type: object - title: Search parameters as query string + description: Search parameters as query string. additionalProperties: false x-discriminator-fields: - params @@ -297,6 +297,7 @@ aroundPrecisionFromValue: title: range objects type: array items: + title: range type: object description: Range object with lower and upper values in meters to define custom ranges. properties: diff --git a/specs/common/schemas/SearchResponse.yml b/specs/common/schemas/SearchResponse.yml index 231acd48ad6..f3c11ff3b39 100644 --- a/specs/common/schemas/SearchResponse.yml +++ b/specs/common/schemas/SearchResponse.yml @@ -20,8 +20,8 @@ baseSearchResponse: type: string description: Distance from a central coordinate provided by `aroundLatLng`. exhaustive: - type: object title: exhaustive + type: object description: Whether certain properties of the search response are calculated exhaustive (exact) or approximated. properties: facetsCount: @@ -75,8 +75,8 @@ baseSearchResponse: type: object description: Statistics for numerical facets. additionalProperties: - type: object title: facetStats + type: object properties: min: type: number @@ -179,6 +179,7 @@ RedirectRuleIndexMetadata: type: boolean description: Redirect rule status. data: + title: redirectRuleIndexData type: object description: Redirect rule data. required: diff --git a/specs/crawler/common/schemas/action.yml b/specs/crawler/common/schemas/action.yml index 70321c71f98..d1d7449bc19 100644 --- a/specs/crawler/common/schemas/action.yml +++ b/specs/crawler/common/schemas/action.yml @@ -63,6 +63,7 @@ Action: items: $ref: '#/urlPattern' recordExtractor: + title: recordExtractor type: object description: Function for extracting information from a crawled page and transforming it into Algolia records for indexing. properties: diff --git a/specs/crawler/common/schemas/configuration.yml b/specs/crawler/common/schemas/configuration.yml index f08ab1a84d2..47daad30e21 100644 --- a/specs/crawler/common/schemas/configuration.yml +++ b/specs/crawler/common/schemas/configuration.yml @@ -116,6 +116,7 @@ Configuration: $ref: '../../../common/schemas/IndexSettings.yml#/indexSettings' x-additionalPropertiesName: indexName linkExtractor: + title: linkExtractor type: object description: Function for extracting URLs for links found on crawled pages. properties: @@ -239,7 +240,8 @@ renderJavaScript: The pattern support globs and wildcard matching with [micromark](https://github.com/micromatch/micromatch). example: https://www.example.com - - type: object + - title: headlessBrowserConfig + type: object description: Configuration for rendering HTML with a headless browser. properties: enabled: diff --git a/specs/crawler/common/schemas/crawlerConfigVersionsResponse.yml b/specs/crawler/common/schemas/crawlerConfigVersionsResponse.yml index fd4fe95a74a..837dc2a85d5 100644 --- a/specs/crawler/common/schemas/crawlerConfigVersionsResponse.yml +++ b/specs/crawler/common/schemas/crawlerConfigVersionsResponse.yml @@ -6,6 +6,7 @@ allOf: type: array description: Configuration changes. items: + title: crawlerConfigVersionsResponse type: object properties: version: diff --git a/specs/crawler/common/schemas/crawlersResponse.yml b/specs/crawler/common/schemas/crawlersResponse.yml index 9c8c240af88..e464a9370e4 100644 --- a/specs/crawler/common/schemas/crawlersResponse.yml +++ b/specs/crawler/common/schemas/crawlersResponse.yml @@ -6,6 +6,7 @@ allOf: type: array description: Crawlers. items: + title: crawlerResponse type: object properties: id: diff --git a/specs/crawler/common/schemas/domainsResponse.yml b/specs/crawler/common/schemas/domainsResponse.yml index 622d615ff1a..e30c1eb55d4 100644 --- a/specs/crawler/common/schemas/domainsResponse.yml +++ b/specs/crawler/common/schemas/domainsResponse.yml @@ -5,6 +5,7 @@ allOf: items: type: array items: + title: domainResponse type: object properties: appId: diff --git a/specs/crawler/common/schemas/responses.yml b/specs/crawler/common/schemas/responses.yml index c1aa38690b6..b655a09c22b 100644 --- a/specs/crawler/common/schemas/responses.yml +++ b/specs/crawler/common/schemas/responses.yml @@ -3,6 +3,7 @@ ActionAcknowledged: content: application/json: schema: + title: actionAcknowledged type: object properties: taskId: @@ -18,6 +19,7 @@ DocSearchCreateApp: content: application/json: schema: + title: docSearchCreatedApp additionalProperties: false type: object properties: diff --git a/specs/crawler/paths/crawler.yml b/specs/crawler/paths/crawler.yml index a9e74c51b39..8bb58662e31 100644 --- a/specs/crawler/paths/crawler.yml +++ b/specs/crawler/paths/crawler.yml @@ -46,6 +46,7 @@ patch: content: application/json: schema: + title: patchCrawler type: object properties: name: diff --git a/specs/crawler/paths/crawlerConfigVersion.yml b/specs/crawler/paths/crawlerConfigVersion.yml index 3d3dc2675ca..d2071d8df27 100644 --- a/specs/crawler/paths/crawlerConfigVersion.yml +++ b/specs/crawler/paths/crawlerConfigVersion.yml @@ -16,6 +16,7 @@ get: content: application/json: schema: + title: configVersion type: object properties: version: diff --git a/specs/crawler/paths/crawlerCrawl.yml b/specs/crawler/paths/crawlerCrawl.yml index 48078f6c51b..80ad0ab8162 100644 --- a/specs/crawler/paths/crawlerCrawl.yml +++ b/specs/crawler/paths/crawlerCrawl.yml @@ -13,6 +13,7 @@ post: content: application/json: schema: + title: crawlUrls type: object properties: urls: diff --git a/specs/crawler/paths/crawlerStats.yml b/specs/crawler/paths/crawlerStats.yml index 3076dbe286d..25f58c1507e 100644 --- a/specs/crawler/paths/crawlerStats.yml +++ b/specs/crawler/paths/crawlerStats.yml @@ -12,6 +12,7 @@ get: content: application/json: schema: + title: crawlerStats type: object properties: count: diff --git a/specs/crawler/paths/crawlerTask.yml b/specs/crawler/paths/crawlerTask.yml index 54bee9a3f54..a0694c8ae5d 100644 --- a/specs/crawler/paths/crawlerTask.yml +++ b/specs/crawler/paths/crawlerTask.yml @@ -13,6 +13,7 @@ get: content: application/json: schema: + title: taskStatus type: object properties: pending: diff --git a/specs/crawler/paths/crawlerTest.yml b/specs/crawler/paths/crawlerTest.yml index d969a30d340..e57913b5979 100644 --- a/specs/crawler/paths/crawlerTest.yml +++ b/specs/crawler/paths/crawlerTest.yml @@ -13,6 +13,7 @@ post: content: application/json: schema: + title: testUrl type: object properties: url: @@ -29,6 +30,7 @@ post: content: application/json: schema: + title: urlTest type: object properties: startDate: @@ -52,6 +54,7 @@ post: type: array description: Extracted records from the URL. items: + title: extractedRecords type: object properties: indexName: @@ -71,6 +74,7 @@ post: type: array description: Partial records generated by each record extractor. items: + title: recordPerExtractor type: object properties: index: @@ -109,6 +113,7 @@ post: externalData1: {data1: 'val1', data2: 'val2'} externalData2: {data1: 'val1', data2: 'val2'} error: + title: urlTestError type: object description: An error. properties: diff --git a/specs/crawler/paths/crawlers.yml b/specs/crawler/paths/crawlers.yml index c0787cf9274..f78f13a6b0a 100644 --- a/specs/crawler/paths/crawlers.yml +++ b/specs/crawler/paths/crawlers.yml @@ -34,6 +34,7 @@ post: content: application/json: schema: + title: crawlerCreate type: object properties: name: @@ -49,6 +50,7 @@ post: content: application/json: schema: + title: crawlerCreateResponse type: object properties: id: diff --git a/specs/crawler/paths/docsearch.yml b/specs/crawler/paths/docsearch.yml index 0eb79bed493..ae530e05007 100644 --- a/specs/crawler/paths/docsearch.yml +++ b/specs/crawler/paths/docsearch.yml @@ -6,6 +6,7 @@ post: content: application/json: schema: + title: docSearchCreateApp type: object properties: ownerEmail: diff --git a/specs/ingestion/common/schemas/authentication.yml b/specs/ingestion/common/schemas/authentication.yml index 90ff4ec6dce..30a709f8593 100644 --- a/specs/ingestion/common/schemas/authentication.yml +++ b/specs/ingestion/common/schemas/authentication.yml @@ -116,7 +116,6 @@ Platform: - type: 'null' AuthGoogleServiceAccountPartial: - title: Google service account type: object description: Credentials for authenticating with a Google service account, such as BigQuery. additionalProperties: false @@ -130,7 +129,6 @@ AuthGoogleServiceAccountPartial: description: Private key of the Google service account. This field is `null` in the API response. AuthBasicPartial: - title: Basic type: object description: Credentials for authenticating with user name and password. additionalProperties: false @@ -143,7 +141,6 @@ AuthBasicPartial: description: Password. This field is `null` in the API response. AuthAPIKeyPartial: - title: API key type: object description: Credentials for authenticating with an API key. additionalProperties: false @@ -153,7 +150,6 @@ AuthAPIKeyPartial: description: API key. This field is `null` in the API response. AuthOAuthPartial: - title: OAuth type: object description: Credentials for authenticating with OAuth 2.0. additionalProperties: false @@ -173,7 +169,6 @@ AuthOAuthPartial: description: OAuth scope. AuthAlgoliaPartial: - title: Algolia type: object description: Credentials for authenticating with Algolia. additionalProperties: false @@ -188,7 +183,6 @@ AuthAlgoliaPartial: This field is `null` in the API response. AuthAlgoliaInsightsPartial: - title: Algolia Insights type: object additionalProperties: false description: Credentials for authenticating with the Algolia Insights API. @@ -203,7 +197,6 @@ AuthAlgoliaInsightsPartial: This field is `null` in the API response. AuthGoogleServiceAccount: - title: Google service account type: object description: Credentials for authenticating with a Google service account, such as BigQuery. additionalProperties: false @@ -220,7 +213,6 @@ AuthGoogleServiceAccount: - privateKey AuthBasic: - title: Basic type: object description: Credentials for authenticating with user name and password. additionalProperties: false @@ -236,7 +228,6 @@ AuthBasic: - password AuthAPIKey: - title: API key type: object description: Credentials for authenticating with an API key. additionalProperties: false @@ -248,7 +239,6 @@ AuthAPIKey: - key AuthOAuth: - title: OAuth type: object description: Credentials for authenticating with OAuth 2.0. additionalProperties: false @@ -272,7 +262,6 @@ AuthOAuth: - client_secret AuthAlgolia: - title: Algolia type: object additionalProperties: false description: Credentials for authenticating with Algolia. @@ -290,7 +279,6 @@ AuthAlgolia: - apiKey AuthAlgoliaInsights: - title: Algolia Insights type: object additionalProperties: false description: Credentials for authenticating with the Algolia Insights API. diff --git a/specs/ingestion/common/schemas/run.yml b/specs/ingestion/common/schemas/run.yml index a85c4e3abad..6204548ad94 100644 --- a/specs/ingestion/common/schemas/run.yml +++ b/specs/ingestion/common/schemas/run.yml @@ -41,6 +41,7 @@ Run: status: $ref: '#/RunStatus' progress: + title: runProgress type: object additionalProperties: false properties: diff --git a/specs/ingestion/common/schemas/source.yml b/specs/ingestion/common/schemas/source.yml index 3e745873cba..1bc6fa5a30e 100644 --- a/specs/ingestion/common/schemas/source.yml +++ b/specs/ingestion/common/schemas/source.yml @@ -110,7 +110,6 @@ SourceType: - sfcc SourceCommercetools: - title: Commercetools type: object additionalProperties: false properties: @@ -175,7 +174,6 @@ CommercetoolsCustomFields: - type: 'null' SourceBigCommerce: - title: BigCommerce type: object additionalProperties: false properties: @@ -243,7 +241,6 @@ UniqueIDColumn: description: Name of a column that contains a unique ID which will be used as `objectID` in Algolia. SourceJSON: - title: JSON type: object additionalProperties: false properties: @@ -262,7 +259,6 @@ MappingTypeCSV: enum: [string, integer, float, boolean, json] SourceCSV: - title: CSV type: object additionalProperties: false properties: @@ -290,7 +286,6 @@ SourceCSV: - url SourceGA4BigQueryExport: - title: GA4 BigQuery export type: object additionalProperties: false properties: @@ -314,7 +309,6 @@ SourceGA4BigQueryExport: - tablePrefix SourceBigQuery: - title: BigQuery type: object additionalProperties: false properties: @@ -348,7 +342,6 @@ BigQueryDataType: enum: [ga4, ga360] SourceDocker: - title: Docker type: object additionalProperties: false properties: @@ -453,7 +446,6 @@ SourceUpdateInput: - $ref: '#/SourceUpdateShopify' SourceUpdateShopify: - title: Shopify type: object additionalProperties: false properties: diff --git a/specs/ingestion/common/schemas/task.yml b/specs/ingestion/common/schemas/task.yml index c5cf97fd8ae..a383b825eee 100644 --- a/specs/ingestion/common/schemas/task.yml +++ b/specs/ingestion/common/schemas/task.yml @@ -291,7 +291,6 @@ ScheduleTriggerType: enum: [schedule] ScheduleTriggerInput: - title: Schedule type: object additionalProperties: false description: Trigger input for scheduled tasks. @@ -330,7 +329,6 @@ OnDemandTriggerType: enum: [onDemand] OnDemandTriggerInput: - title: On demand type: object additionalProperties: false description: Trigger information for manually-triggered tasks. @@ -360,7 +358,6 @@ SubscriptionTriggerType: enum: [subscription] SubscriptionTrigger: - title: Subscription type: object additionalProperties: false description: Trigger input for subscription tasks. @@ -378,7 +375,6 @@ StreamingTriggerType: enum: [streaming] StreamingTrigger: - title: Streaming type: object additionalProperties: false description: Trigger input for continuously running tasks. @@ -450,7 +446,6 @@ MappingInput: - actions StreamingInput: - title: Streaming input type: object additionalProperties: false description: Input for a `streaming` task whose source is of type `ga4BigqueryExport` and for which extracted data is continuously streamed. @@ -461,7 +456,7 @@ StreamingInput: - mapping DockerStreamsInput: - title: The selected streams of a singer or airbyte connector. + description: The selected streams of a singer or airbyte connector. type: object properties: streams: @@ -476,7 +471,6 @@ failureThreshold: description: Maximum accepted percentage of failures for a task run to finish successfully. ShopifyInput: - title: Shopify input type: object additionalProperties: false description: Represents the required elements of the task input when using a `shopify` source. diff --git a/specs/ingestion/common/schemas/transformation.yml b/specs/ingestion/common/schemas/transformation.yml index e7a4f508604..e037871a6bd 100644 --- a/specs/ingestion/common/schemas/transformation.yml +++ b/specs/ingestion/common/schemas/transformation.yml @@ -107,6 +107,7 @@ TransformationTryResponse: items: type: object error: + title: transformationError type: object description: The error if the transformation failed. properties: diff --git a/specs/insights/paths/pushEvents.yml b/specs/insights/paths/pushEvents.yml index c92be6dadf2..25b51fb7ae2 100644 --- a/specs/insights/paths/pushEvents.yml +++ b/specs/insights/paths/pushEvents.yml @@ -13,7 +13,7 @@ post: content: application/json: schema: - title: InsightsEvents + title: insightsEvents type: object additionalProperties: false required: diff --git a/specs/monitoring/common/responses/BadRequestResponse.yml b/specs/monitoring/common/responses/BadRequestResponse.yml index 998eb165f6e..0b8a6873b2d 100644 --- a/specs/monitoring/common/responses/BadRequestResponse.yml +++ b/specs/monitoring/common/responses/BadRequestResponse.yml @@ -2,6 +2,7 @@ description: Bad Request. content: application/json: schema: + title: badRequest type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/ForbiddenResponse.yml b/specs/monitoring/common/responses/ForbiddenResponse.yml index 9ac55d8d326..0055af1728b 100644 --- a/specs/monitoring/common/responses/ForbiddenResponse.yml +++ b/specs/monitoring/common/responses/ForbiddenResponse.yml @@ -2,6 +2,7 @@ description: Forbidden content: application/json: schema: + title: forbidden type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/IncidentsResponse.yml b/specs/monitoring/common/responses/IncidentsResponse.yml index 7b5ba02416d..e9d39ae41f5 100644 --- a/specs/monitoring/common/responses/IncidentsResponse.yml +++ b/specs/monitoring/common/responses/IncidentsResponse.yml @@ -2,7 +2,7 @@ description: OK content: application/json: schema: - title: IncidentsResponse + title: incidentsResponse type: object properties: incidents: diff --git a/specs/monitoring/common/responses/IndexingResponse.yml b/specs/monitoring/common/responses/IndexingResponse.yml index e6fba0f2643..9816e6e7902 100644 --- a/specs/monitoring/common/responses/IndexingResponse.yml +++ b/specs/monitoring/common/responses/IndexingResponse.yml @@ -2,10 +2,11 @@ description: OK content: application/json: schema: - title: IndexingTimeResponse + title: indexingTimeResponse type: object properties: metrics: + title: indexingMetric type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/InfrastructureAPIUnauthorized.yml b/specs/monitoring/common/responses/InfrastructureAPIUnauthorized.yml index 8480c8316e5..0197ed26d8c 100644 --- a/specs/monitoring/common/responses/InfrastructureAPIUnauthorized.yml +++ b/specs/monitoring/common/responses/InfrastructureAPIUnauthorized.yml @@ -2,6 +2,7 @@ description: Unauthorized content: application/json: schema: + title: unauthorized type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/InfrastructureResponse.yml b/specs/monitoring/common/responses/InfrastructureResponse.yml index ccfdfb80a7a..3a3f41ce4ce 100644 --- a/specs/monitoring/common/responses/InfrastructureResponse.yml +++ b/specs/monitoring/common/responses/InfrastructureResponse.yml @@ -2,11 +2,12 @@ description: OK content: application/json: schema: - title: InfrastructureResponse + title: infrastructureResponse type: object additionalProperties: false properties: metrics: + title: metrics type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/InventoryResponse.yml b/specs/monitoring/common/responses/InventoryResponse.yml index 67f9543a05b..0208fc59b4c 100644 --- a/specs/monitoring/common/responses/InventoryResponse.yml +++ b/specs/monitoring/common/responses/InventoryResponse.yml @@ -2,7 +2,7 @@ description: OK content: application/json: schema: - title: InventoryResponse + title: inventoryResponse type: object properties: inventory: diff --git a/specs/monitoring/common/responses/LatencyResponse.yml b/specs/monitoring/common/responses/LatencyResponse.yml index fd38ab1f39c..c25ae6ed73d 100644 --- a/specs/monitoring/common/responses/LatencyResponse.yml +++ b/specs/monitoring/common/responses/LatencyResponse.yml @@ -2,10 +2,11 @@ description: OK content: application/json: schema: - title: LatencyResponse + title: latencyResponse type: object properties: metrics: + title: latencyMetric type: object additionalProperties: false properties: diff --git a/specs/monitoring/common/responses/ReachabilityResponse.yml b/specs/monitoring/common/responses/ReachabilityResponse.yml index 855cf0fa4db..d99413ef9ac 100644 --- a/specs/monitoring/common/responses/ReachabilityResponse.yml +++ b/specs/monitoring/common/responses/ReachabilityResponse.yml @@ -2,7 +2,7 @@ description: OK content: application/json: schema: - title: ReachabilityResponse + title: reachabilityResponse type: object additionalProperties: x-additionalPropertiesName: cluster diff --git a/specs/monitoring/common/responses/StatusResponse.yml b/specs/monitoring/common/responses/StatusResponse.yml index 7329d7f83e3..b1e8b9feee2 100644 --- a/specs/monitoring/common/responses/StatusResponse.yml +++ b/specs/monitoring/common/responses/StatusResponse.yml @@ -2,7 +2,7 @@ description: OK content: application/json: schema: - title: StatusResponse + title: statusResponse type: object properties: status: diff --git a/specs/query-suggestions/common/schemas/Configuration.yml b/specs/query-suggestions/common/schemas/Configuration.yml index 669feccd250..bcf47ba1290 100644 --- a/specs/query-suggestions/common/schemas/Configuration.yml +++ b/specs/query-suggestions/common/schemas/Configuration.yml @@ -1,11 +1,8 @@ ConfigurationWithIndex: - type: object description: Query Suggestions configuration. - required: - - indexName - - sourceIndices allOf: - type: object + additionalProperties: false properties: indexName: $ref: './IndexName.yml' diff --git a/specs/query-suggestions/paths/getConfigurationStatus.yml b/specs/query-suggestions/paths/getConfigurationStatus.yml index ce89a40c1eb..effa05644ce 100644 --- a/specs/query-suggestions/paths/getConfigurationStatus.yml +++ b/specs/query-suggestions/paths/getConfigurationStatus.yml @@ -14,6 +14,7 @@ get: content: application/json: schema: + title: configStatus type: object additionalProperties: false properties: diff --git a/specs/query-suggestions/paths/getLogFile.yml b/specs/query-suggestions/paths/getLogFile.yml index dd8cba15a3f..7a10a7d9e9c 100644 --- a/specs/query-suggestions/paths/getLogFile.yml +++ b/specs/query-suggestions/paths/getLogFile.yml @@ -14,6 +14,7 @@ get: content: application/json: schema: + title: logFile type: object additionalProperties: false properties: diff --git a/specs/recommend/common/schemas/RecommendRule.yml b/specs/recommend/common/schemas/RecommendRule.yml index ce52034204c..328da173fc8 100644 --- a/specs/recommend/common/schemas/RecommendRule.yml +++ b/specs/recommend/common/schemas/RecommendRule.yml @@ -4,6 +4,7 @@ RecommendRule: additionalProperties: false properties: _metadata: + title: ruleMetadata type: object description: Rule metadata. properties: diff --git a/specs/recommend/paths/searchRecommendRules.yml b/specs/recommend/paths/searchRecommendRules.yml index 71ecf17f5ca..1ceb30bcabe 100644 --- a/specs/recommend/paths/searchRecommendRules.yml +++ b/specs/recommend/paths/searchRecommendRules.yml @@ -18,8 +18,8 @@ post: content: application/json: schema: - type: object title: searchRecommendRulesParams + type: object description: Recommend rules parameters. additionalProperties: false properties: diff --git a/specs/search/common/schemas/SearchForFacetValuesResponse.yml b/specs/search/common/schemas/SearchForFacetValuesResponse.yml index 330cb86b7ee..7e6794c5e6e 100644 --- a/specs/search/common/schemas/SearchForFacetValuesResponse.yml +++ b/specs/search/common/schemas/SearchForFacetValuesResponse.yml @@ -11,8 +11,8 @@ searchForFacetValuesResponse: type: array description: Matching facet values. items: - type: object title: facetHits + type: object additionalProperties: false required: - value diff --git a/specs/search/paths/advanced/getLogs.yml b/specs/search/paths/advanced/getLogs.yml index 802f37c1f30..b28237199a4 100644 --- a/specs/search/paths/advanced/getLogs.yml +++ b/specs/search/paths/advanced/getLogs.yml @@ -127,8 +127,8 @@ get: type: array description: Queries performed for the given request. items: - type: object title: logQuery + type: object properties: index_name: type: string diff --git a/specs/search/paths/objects/getObjects.yml b/specs/search/paths/objects/getObjects.yml index e4a1ac0fb28..ece7e937a6a 100644 --- a/specs/search/paths/objects/getObjects.yml +++ b/specs/search/paths/objects/getObjects.yml @@ -25,8 +25,8 @@ post: requests: type: array items: - description: Request body for retrieving records. title: getObjectsRequest + description: Request body for retrieving records. type: object additionalProperties: false required: diff --git a/specs/search/paths/rules/searchRules.yml b/specs/search/paths/rules/searchRules.yml index 7adfc70cecf..74e34f81563 100644 --- a/specs/search/paths/rules/searchRules.yml +++ b/specs/search/paths/rules/searchRules.yml @@ -14,8 +14,8 @@ post: content: application/json: schema: - type: object title: searchRulesParams + type: object description: Rules search parameters. additionalProperties: false properties: diff --git a/specs/usage/common/schemas/responses.yml b/specs/usage/common/schemas/responses.yml index d37a3edbce4..d619bc32cbf 100644 --- a/specs/usage/common/schemas/responses.yml +++ b/specs/usage/common/schemas/responses.yml @@ -3,11 +3,13 @@ Success: content: application/json: schema: + title: usage type: object properties: statistics: type: array items: + title: statistic type: object properties: t: From 48e282311dc7b0a34d920d35a9d3ac4aa715f995 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 17:03:44 +0200 Subject: [PATCH 2/8] more explicit errors --- eslint/src/rules/validInlineTitle.ts | 24 +++++++++++++++++------- eslint/tests/validInlineTitle.test.ts | 18 +++++++++++++++--- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/eslint/src/rules/validInlineTitle.ts b/eslint/src/rules/validInlineTitle.ts index 5c70b5fb246..c9cdacd3c79 100644 --- a/eslint/src/rules/validInlineTitle.ts +++ b/eslint/src/rules/validInlineTitle.ts @@ -9,8 +9,10 @@ export const validInlineTitle: Rule.RuleModule = { 'title must be set in inline models, should be the first property and start with a lowercase', }, messages: { - validInlineTitle: - 'title must be set in inline models, should be the first property and start with a lowercase', + inlineTitleExists: 'title must be set in inline models', + lowercaseTitle: 'title must start with a lowercase', + firstProperty: 'title must be the first property', + noSpaceInTitle: 'title must not contain spaces', }, }, create(context) { @@ -38,14 +40,22 @@ export const validInlineTitle: Rule.RuleModule = { isPairWithKey(pair, 'title') ); const titleNode = title?.value; + const titleValue = (titleNode as any)?.value as string; if ( titleNode && - (titleNode.type !== 'YAMLScalar' || - !/^[a-z]/.test(titleNode.value as string)) + (titleNode.type !== 'YAMLScalar' || !/^[a-z]/.test(titleValue)) ) { context.report({ node: title, - messageId: 'validInlineTitle', + messageId: 'lowercaseTitle', + }); + } + + // make sure title doesn't contain spaces + if (titleValue?.includes(' ')) { + context.report({ + node: title, + messageId: 'noSpaceInTitle', }); } @@ -74,7 +84,7 @@ export const validInlineTitle: Rule.RuleModule = { if (!title) { context.report({ node: node.value, - messageId: 'validInlineTitle', + messageId: 'inlineTitleExists', }); return; @@ -84,7 +94,7 @@ export const validInlineTitle: Rule.RuleModule = { if (!isPairWithKey(node.parent.pairs[0], 'title')) { context.report({ node: title, - messageId: 'validInlineTitle', + messageId: 'firstProperty', }); } }, diff --git a/eslint/tests/validInlineTitle.test.ts b/eslint/tests/validInlineTitle.test.ts index a8635dc3815..b15ade89f3c 100644 --- a/eslint/tests/validInlineTitle.test.ts +++ b/eslint/tests/validInlineTitle.test.ts @@ -50,7 +50,7 @@ currencies: type: string title: Currency `, - errors: [{ messageId: 'validInlineTitle' }], + errors: [{ messageId: 'inlineTitleExists' }], }, { code: ` @@ -65,7 +65,7 @@ currencies: type: string title: Currency `, - errors: [{ messageId: 'validInlineTitle' }], + errors: [{ messageId: 'firstProperty' }], }, { code: ` @@ -77,7 +77,19 @@ currencies: title: UpperCaseNotFine type: object `, - errors: [{ messageId: 'validInlineTitle' }], + errors: [{ messageId: 'lowercaseTitle' }], + }, + { + code: ` +currencies: + title: spaces are fine + type: object + properties: + inner: + title: spaces are not fine + type: object + `, + errors: [{ messageId: 'noSpaceInTitle' }], }, ], }); From ef75be74f53a7e48627de15808318893027701ba Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 17:19:02 +0200 Subject: [PATCH 3/8] fix usage --- .../com/algolia/codegen/cts/tests/ParametersWithDataType.java | 2 ++ specs/usage/common/schemas/responses.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java b/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java index 03d4a1a5b4c..4645e63af99 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java +++ b/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java @@ -329,6 +329,8 @@ private void handleModel( return; } + System.out.println(param); + Map vars = (Map) param; List> values = new ArrayList<>(); List> additionalPropertyValues = new ArrayList<>(); diff --git a/specs/usage/common/schemas/responses.yml b/specs/usage/common/schemas/responses.yml index d619bc32cbf..b34d4e9e56f 100644 --- a/specs/usage/common/schemas/responses.yml +++ b/specs/usage/common/schemas/responses.yml @@ -3,13 +3,13 @@ Success: content: application/json: schema: - title: usage + title: indexUsage type: object properties: statistics: type: array items: - title: statistic + title: statisticEntry type: object properties: t: From 4b7156aad656f04a67b2c94ec7819fd26d7923aa Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 17:38:00 +0200 Subject: [PATCH 4/8] fix duplicate models --- .../java/com/algolia/codegen/AlgoliaSwiftGenerator.java | 4 +++- .../clients/algoliasearch/builds/models.mustache | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index 9570a139a08..dc9203af2f4 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -66,6 +66,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "facetordering", "facets", "facetsstats", + "forbidden", "highlightresult", "highlightresultoption", "ignoreplurals", @@ -83,10 +84,11 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "promoteobjectids", "querysuggestionsconfiguration", "querytype", + "range", "rankinginfo", "redirect", "redirectruleindexmetadata", - "redirectruleindexmetadatadata", + "redirectruleindexdata", "redirecturl", "region", "removestopwords", diff --git a/templates/javascript/clients/algoliasearch/builds/models.mustache b/templates/javascript/clients/algoliasearch/builds/models.mustache index 49a23b9af20..378d4b09956 100644 --- a/templates/javascript/clients/algoliasearch/builds/models.mustache +++ b/templates/javascript/clients/algoliasearch/builds/models.mustache @@ -10,7 +10,6 @@ import { AlternativesAsExact, Anchoring, AroundPrecision, - AroundPrecisionFromValueInner, AroundRadius, AroundRadiusAll, AutomaticFacetFilter, @@ -55,11 +54,12 @@ import { PromoteObjectID, PromoteObjectIDs, QueryType, + Range, RankingInfo, ReRankingApplyFilter, Redirect, RedirectRuleIndexMetadata, - RedirectRuleIndexMetadataData, + RedirectRuleIndexData, RedirectURL, RemoveStopWords, RemoveWordsIfNoResults, @@ -97,7 +97,6 @@ export { AlternativesAsExact, Anchoring, AroundPrecision, - AroundPrecisionFromValueInner, AroundRadius, AroundRadiusAll, AutomaticFacetFilter, @@ -141,11 +140,12 @@ export { PromoteObjectID, PromoteObjectIDs, QueryType, + Range, RankingInfo, ReRankingApplyFilter, Redirect, RedirectRuleIndexMetadata, - RedirectRuleIndexMetadataData, + RedirectRuleIndexData, RedirectURL, RemoveStopWords, RemoveWordsIfNoResults, From b4bd9d16164d0f1ef509149c5165fab59e7b9a87 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 17:39:25 +0200 Subject: [PATCH 5/8] remove log --- .../com/algolia/codegen/cts/tests/ParametersWithDataType.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java b/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java index 4645e63af99..03d4a1a5b4c 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java +++ b/generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java @@ -329,8 +329,6 @@ private void handleModel( return; } - System.out.println(param); - Map vars = (Map) param; List> values = new ArrayList<>(); List> additionalPropertyValues = new ArrayList<>(); From e74d058c68d5980ec8bfe97e219aa860c9ee01b8 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 18:47:03 +0200 Subject: [PATCH 6/8] small fixes --- scripts/formatter.ts | 2 +- specs/analytics/common/parameters.yml | 2 +- specs/monitoring/common/schemas/Incidents.yml | 1 + specs/monitoring/common/schemas/Time.yml | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/formatter.ts b/scripts/formatter.ts index fa4895e7eed..70f7e2b02a0 100644 --- a/scripts/formatter.ts +++ b/scripts/formatter.ts @@ -29,7 +29,7 @@ export async function formatter(language: string, cwd: string): Promise { break; case 'java': await run( - `find . -type f -name "*.java" | xargs java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ + `find . -path ./.gradle -prune -o -type f -name "*.java" | xargs java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ diff --git a/specs/analytics/common/parameters.yml b/specs/analytics/common/parameters.yml index d35e7a0800d..d9694cf8b6c 100644 --- a/specs/analytics/common/parameters.yml +++ b/specs/analytics/common/parameters.yml @@ -243,7 +243,7 @@ purchaseCount: example: 10 currencies: - title: currencies + title: currenciesValue type: object description: Revenue associated with this search, broken-down by currencies. default: {} diff --git a/specs/monitoring/common/schemas/Incidents.yml b/specs/monitoring/common/schemas/Incidents.yml index 7d461e17877..584726f740b 100644 --- a/specs/monitoring/common/schemas/Incidents.yml +++ b/specs/monitoring/common/schemas/Incidents.yml @@ -2,6 +2,7 @@ title: incidents description: Key-value pairs with the cluster names as keys and the list of incidents reported for this cluster as values. type: array items: + title: incident type: object properties: t: diff --git a/specs/monitoring/common/schemas/Time.yml b/specs/monitoring/common/schemas/Time.yml index cc6def364da..ffb1a205658 100644 --- a/specs/monitoring/common/schemas/Time.yml +++ b/specs/monitoring/common/schemas/Time.yml @@ -1,7 +1,8 @@ -title: time +title: times description: Time measured by a probe. type: array items: + title: timeEntry type: object additionalProperties: false properties: From 23828ce863727949057cc8d61ca9784d40f93922 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 19:02:15 +0200 Subject: [PATCH 7/8] fix incident dup --- specs/monitoring/common/schemas/Incidents.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/monitoring/common/schemas/Incidents.yml b/specs/monitoring/common/schemas/Incidents.yml index 584726f740b..dde1738d1c1 100644 --- a/specs/monitoring/common/schemas/Incidents.yml +++ b/specs/monitoring/common/schemas/Incidents.yml @@ -2,7 +2,7 @@ title: incidents description: Key-value pairs with the cluster names as keys and the list of incidents reported for this cluster as values. type: array items: - title: incident + title: incidentEntry type: object properties: t: From a2bd2f8ffd73e3097e8d4fbbea0a4a829c32a1e4 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 29 Jul 2024 22:24:00 +0200 Subject: [PATCH 8/8] revert --- specs/query-suggestions/common/schemas/Configuration.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/query-suggestions/common/schemas/Configuration.yml b/specs/query-suggestions/common/schemas/Configuration.yml index bcf47ba1290..cfb2b043001 100644 --- a/specs/query-suggestions/common/schemas/Configuration.yml +++ b/specs/query-suggestions/common/schemas/Configuration.yml @@ -1,5 +1,9 @@ ConfigurationWithIndex: + type: object description: Query Suggestions configuration. + required: + - indexName + - sourceIndices allOf: - type: object additionalProperties: false