Skip to content
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

Wrap get indexes routes in results object v0.28 #1261

Merged
merged 13 commits into from
Jun 20, 2022

Conversation

bidoubiwa
Copy link
Contributor

Changes related to the HTTP verbs

Related to:
issue: meilisearch/meilisearch#2419

  • PATCH /indexes/{indexUid} instead of PUT

Changes related to the indexes resources

Related to:
issue: meilisearch/meilisearch#2373

All the changes:

  • Remove the name field in the index.
  • Wrap the indexes objects in a results key.
client.getIndexes()

returns for example

{
   results: [ Index(uid: "movies" ) ]
}
client.getRawIndexes()

returns for example

{
   results: [ { uid: "movies" ... } ]
}

@bidoubiwa bidoubiwa added the breaking-change The related changes are breaking for the users label Jun 15, 2022
@bidoubiwa bidoubiwa force-pushed the update_get_indexes_routes branch from 916f3d3 to b982aab Compare June 15, 2022 13:00
@bidoubiwa bidoubiwa force-pushed the update_tests_impacted_by_task branch from db1ce66 to ec81fba Compare June 15, 2022 13:12
Base automatically changed from update_tests_impacted_by_task to bump-meilisearch-v0.28.0 June 15, 2022 13:58
(index) => new Index(this.config, index.uid, index.primaryKey)
)
return indexes
return { ...rawIndexes, results: indexes }
Copy link
Member

Choose a reason for hiding this comment

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

I think the name rawIndexes confusing because in my first read I understood that your method would result in this response:

{
   "results": [],
   results: [....]
}

I know that's impossible in JS, but in ruby for example isn't (because results: is a symbol, and "results" is a string a different type of object). Anyway, I think you could call the rawIndexes as just response?

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'm not sure I understand :/

The following will override the results key of rawIndexes with the new results key so that results is an array of Index() and not an array of { uid: 1 }

{ ...rawIndexes, results: indexes }

RawIndexes returns like this:

{
   results: [ { uid: 1 .. } ], 
   limit: 0, 
   // ...
}

and getIndexes returns like this

{
   results: [ Index(uid: 1), Index(uid: 2)], 
   limit: 0, 
   // ...
}

@bidoubiwa bidoubiwa changed the title Wrap get indexes routes in results object Wrap get indexes routes in results object v0.28 Jun 16, 2022
@bidoubiwa bidoubiwa merged commit b8cec6e into bump-meilisearch-v0.28.0 Jun 20, 2022
@bidoubiwa bidoubiwa deleted the update_get_indexes_routes branch June 20, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants