[Docs] [Minor] Tweak `get_` & `delete_document` Method Signature
Description
Documents Documentation Page (#get-one-document) suggests using int, while the current implementation requires str. Same with delete_document and delete_documents.
Solution
Adjust the method signature parameter or documentation.
Currently, the str type is required in (according to docs):
- Java
- Go
- Rust
The int type is passed in:
- JavaScript
- PHP
- Ruby
- Swift
- Dart
Fork with Tweak
If it will be concluded that it's best to tweak the method signature, then the fork is here (PR Here). Else, the docs can be updated to string parameters for these methods.
Images


Cheers!
I believe str is the correct type for the id, I don't think only ints are allowed. From the docs "The document id must contain only A-Z a-z 0-9 and -_ characters.", so I think it is the examples in the docs that need updating. That can be done by updating the examples in the code-samples.meilisearch.yaml file
Hi @Luzkan,
Thank you for raising this issue, but @sanders41 is right. An id can contain A-Z a-z 0-9 so it's normally a string and is passed through the URL. If you check closely, most SDKs take both str and int for ease of use but Sander's point about the code examples is interesting and I'll talk to the @meilisearch/integration-team to see if the examples should all be passed as strings.
In the meantime, I will close the dedicated PR to this issue.
@alallema I didn’t consider taking both options. Since it works both ways maybe updating the type to take both would be an option. Then there would be no need for the user to convert an int to a str to prevent a type error. It gets converted to a string in the methods when putting it into the URL already so it would be one less step for the end user.
The exception would be if there is anywhere the parameter is added to a dict and passed in the request body instead of the URL, but I can’t think of anywhere currently where the id is passed as a parameter and added to a dict
(Hey @Luzkan, completely unrelated but what are you using as a tool to darken your views?)
@bidoubiwa 😸
I'm doing it with this combo: win + shift + s -> crop -> onpaste.com -> ctrl + v -> highlight -> save / win + shift + s.
@alallema I didn’t consider taking both options. Since it works both ways maybe updating the type to take both would be an option. Then there would be no need for the user to convert an int to a str to prevent a type error. It gets converted to a string in the methods when putting it into the URL already so it would be one less step for the end user.
The exception would be if there is anywhere the parameter is added to a dict and passed in the request body instead of the URL, but I can’t think of anywhere currently where the id is passed as a parameter and added to a dict
Yes, I really like the idea of adding the possibility to take both types, it would be the best option for me and I don't see any place where it could be a problem either.