diff --git a/scripts/specs/format.ts b/scripts/specs/format.ts index 6fe2e9500ab..5d33c045492 100644 --- a/scripts/specs/format.ts +++ b/scripts/specs/format.ts @@ -81,9 +81,22 @@ export async function bundleSpecsForDoc(bundledPath: string, clientName: string) // skip custom path for cURL if (pathKey !== '/{path}' && specMethod['x-codeSamples']) { - const harRequest = harRequests.find((baseHarRequest) => - baseHarRequest.url.includes(pathKey.replace('{indexName}', 'ALGOLIA_INDEX_NAME')), - ); + const harRequest = harRequests.find((baseHarRequest) => { + // the url also has the query parameters, so we need to check if it ends with the path + // all the variables are also replaced by the example in the spec, so we need to check with a regex. + const urlRegex = new RegExp( + `${pathKey + .replace('{indexName}', 'ALGOLIA_INDEX_NAME') + .replace('*', '\\*') + .replace(/\{.*?\}/g, '.*?')}($|\\?)`, + ); + return ( + baseHarRequest.url.match(urlRegex) !== null && baseHarRequest.method.toLowerCase() === method.toLowerCase() + ); + }); + if (!harRequest) { + throw new Error(`Could not find a the correct HAR request for ${method} ${pathKey}`); + } if (!harRequest?.headers) { break; diff --git a/specs/composition-full/paths/search/search.yml b/specs/composition-full/paths/search/search.yml index 693426b7541..317715ef48a 100644 --- a/specs/composition-full/paths/search/search.yml +++ b/specs/composition-full/paths/search/search.yml @@ -1,6 +1,6 @@ post: tags: - - search + - Search operationId: search x-use-read-transporter: true x-cacheable: true diff --git a/specs/composition-full/paths/search/searchForFacetValues.yml b/specs/composition-full/paths/search/searchForFacetValues.yml index 9724810108d..191d2ffc8b7 100644 --- a/specs/composition-full/paths/search/searchForFacetValues.yml +++ b/specs/composition-full/paths/search/searchForFacetValues.yml @@ -1,6 +1,6 @@ post: tags: - - search + - Search operationId: searchForFacetValues x-use-read-transporter: true x-cacheable: true diff --git a/specs/composition/spec.yml b/specs/composition/spec.yml index 459eee13f41..477f438bfd4 100644 --- a/specs/composition/spec.yml +++ b/specs/composition/spec.yml @@ -107,21 +107,18 @@ security: - appId: [] apiKey: [] tags: - - name: compositions - x-displayName: Compositions + - name: Compositions description: | Manage your compositions and composition settings. - - name: rules - x-displayName: Rules + - name: Rules description: | Manage your compositions rules. - - name: search - x-displayName: Search + - name: Search description: Search one composition for matching records or facet values. x-tagGroups: - name: Compositions tags: - - search + - Search paths: # ######################## # ### Search Endpoints ### diff --git a/specs/query-suggestions/common/schemas/IndexName.yml b/specs/query-suggestions/common/schemas/IndexName.yml index 43881b00e2e..50ef5ba60a7 100644 --- a/specs/query-suggestions/common/schemas/IndexName.yml +++ b/specs/query-suggestions/common/schemas/IndexName.yml @@ -1,4 +1,4 @@ title: indexName type: string description: Name of the Query Suggestions index (case-sensitive). -example: products_query_suggestions +example: ALGOLIA_INDEX_NAME