Skip to content

refactor(specs): mutualise code between Search API & Comp API for search query parameters #5125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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

🪓 The generated code will be pushed at the end of the CI.

Action triggered by commit b83c83e5d25286761b03c2b20a62bd6dae033ddb.

Please do not push any generated code to this pull request.

@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)

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.

3 participants