Skip to content

Conversation

ClaraMuller
Copy link
Contributor

@ClaraMuller ClaraMuller commented Jul 16, 2025

🧭 What and Why

🎟 JIRA Ticket: Work preparation for https://algolia.atlassian.net/browse/CMP-484

Composition API team is preparing update of the API clients with writes endpoints (see full list of endpoints here).
Goals of this PR is to cleanup / refactor the current Open API spec to ease the integrations of the new endpoints.

Stack PRs:

Changes included:

Remove code duplication in file specs/composition-full/common/params/Search.yml where a lot of parameters where copy pasted from the files specs/common/schemas/SearchParams.yml & specs/common/schemas/IndexSettings.yml.

To achieve that, multiple schema has been extracted to make them available to be re-use directly.
Schemas have been extracted from the following objects:

  • baseSearchParamsWithoutQuery in specs/common/schemas/SearchParams.yml
  • indexSettingsAsSearchParams in specs/common/schemas/IndexSettings.yml

🧪 Test

  • CI
  • Locally run
    • yarn cli build specs all
    • yarn cli build clients javascript
    • yarn cli generate javascript
    • yarn cli generate go

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jul 16, 2025

✔️ Code generated!

Name Link
🪓 Triggered by 073ce86d5bf66057a2022cf19ed362c92f44d132
🍃 Generated commit 89a81e2d6bfd5826a626de04a285075ac424fc2c
🌲 Generated branch generated/clara/refact/search-params-mutualised
📊 Benchmark results

Benchmarks performed on the method using a mock server, the results might not reflect the real-world performance.

Language Req/s
go 1768
javascript 1605
php 1452
csharp 1215
python 1169
java 1009
ruby 796
swift 470
scala 23

@ClaraMuller ClaraMuller changed the title refactor(specs): mutualise code between for search query parameter refactor(specs): mutualise code between Search API & Comp API for search query parameters Jul 16, 2025
@ClaraMuller ClaraMuller force-pushed the clara/refact/add-params-interface branch from 825c35d to aec0c49 Compare July 18, 2025 08:28
Base automatically changed from clara/refact/add-params-interface to main July 21, 2025 07:01
@ClaraMuller ClaraMuller force-pushed the clara/refact/search-params-mutualised branch 3 times, most recently from 5fd8e66 to 9f7905b Compare July 23, 2025 09:29
@ClaraMuller ClaraMuller requested a review from a team July 23, 2025 10:05
Comment on lines 481 to 485
advancedSyntaxFeaturesEnum:
type: string
enum: [exactPhrase, excludeWords]
x-categories:
- Query strategy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of those Enum suffix should be renamed to their original name (without the Enum), otherwise it changes the model generated and the import, which is a breaking change
Screenshot 2025-07-23 at 12 38 42

Copy link
Contributor Author

@ClaraMuller ClaraMuller Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but what should be the good values ? The previous enum was using the name of the query parameter.
If I call the enum by the query parameter name, what should be the value to identify the query parameter ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the generator only create a model for the enum, not the array of enum, so I think you can just name it AlternativesAsExact like before, no?

Copy link
Contributor Author

@ClaraMuller ClaraMuller Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By putting the same values I have the following error:

/Users/clara.muller/workspace/repos-algolia/api-clients-automation/specs/common/schemas/IndexSettings.yml
  896:0  error  Parsing error: Map keys must be unique

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a proposal in the last commit, tell me what do you think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn cli generate javascript is working locally

@ClaraMuller ClaraMuller marked this pull request as ready for review July 23, 2025 13:42
@ClaraMuller ClaraMuller requested a review from a team as a code owner July 23, 2025 13:42
@ClaraMuller ClaraMuller requested review from Fluf22 and shortcuts July 23, 2025 13:42
@ClaraMuller ClaraMuller force-pushed the clara/refact/search-params-mutualised branch from 79cac42 to ef18a2f Compare July 23, 2025 14:56
@ClaraMuller
Copy link
Contributor Author

@Fluf22 @shortcuts Small ping on the PR.
I think we did not conclude of how to handle this conflict: #5125 (comment)

@gavinwade12 gavinwade12 force-pushed the clara/refact/search-params-mutualised branch from ef18a2f to 3914261 Compare August 4, 2025 18:05
@gavinwade12 gavinwade12 force-pushed the clara/refact/search-params-mutualised branch from 4cefdd3 to 93b68b4 Compare August 5, 2025 17:18
@gavinwade12
Copy link
Contributor

@Fluf22 @shortcuts 👋 Clara handed this PR off to me before she left for PTO. I pushed a commit to fix the issue with her last commit, and the CI is green again. Could you please have another look? It seems like there was an unresolved comment: #5125 (comment)

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a great cleanup!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure what's the point of this file anymore if all it does is referencing the common specification, we could directly import the common ones instead of this one, no?

@gavinwade12 gavinwade12 force-pushed the clara/refact/search-params-mutualised branch from 640a997 to c004dd2 Compare August 8, 2025 13:43
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean! gg

@shortcuts shortcuts merged commit 4867203 into main Aug 8, 2025
29 checks passed
@shortcuts shortcuts deleted the clara/refact/search-params-mutualised branch August 8, 2025 14:18
algolia-bot added a commit that referenced this pull request Aug 8, 2025
…rch query parameters (#5125) (generated) [skip ci]

Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-csharp that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-dart that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-go that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-java that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-javascript that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-kotlin that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-php that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-python that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-ruby that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-scala that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
algolia-bot added a commit to algolia/algoliasearch-client-swift that referenced this pull request Aug 8, 2025
…rch query parameters (generated)

algolia/api-clients-automation#5125

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clara Muller <[email protected]>
Co-authored-by: shortcuts <[email protected]>
Co-authored-by: Gavin Wade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants