typesense / typesense-go

Go client for Typesense: https://github.com/typesense/typesense
Apache License 2.0
222 stars 56 forks source link

update typesense version, add fields #73

Closed minarc closed 3 years ago

minarc commented 3 years ago

Change Summary

update typesense version to 0.21.0 and add the fields 'text_match' and fix the 'took_ms' to 'search_time_ms'

PR Checklist

v-byte-cpu commented 3 years ago

@minarc These type structs are generated from the OpenAPI spec here.

Can you please update the YAML spec and regenerate the types using oapi-codegen? You can see the commands to generate the autogenerated code here: https://github.com/typesense/typesense-go/blob/master/typesense/api/doc.go or just use go generate ./...

minarc commented 3 years ago

Thank you for your advice @v-byte-cpu

kishorenc commented 3 years ago

Going forward, the plan is to keep the open API spec updated here:

https://github.com/typesense/typesense-api-spec/blob/master/openapi.yml

@shivag46 has helped in making one round of updates to it, but it seems to be missing search_time_ms and text_match.

minarc commented 3 years ago

@kishorenc I think typesense changed 'took_ms' to 'search_time_ms' from some version update.

shivag46 commented 3 years ago

Going forward, the plan is to keep the open API spec updated here:

https://github.com/typesense/typesense-api-spec/blob/master/openapi.yml

@shivag46 has helped in making one round of updates to it, but it seems to be missing search_time_ms and text_match.

I guess I missed those fields. Will add them

kishorenc commented 3 years ago

Oh right took_ms was changed a while back. So we need to replace took_ms with search_time_ms and then also add text_match @shivag46.

shivag46 commented 3 years ago

Oh right took_ms was changed a while back. So we need to replace took_ms with search_time_ms and then also add text_match @shivag46.

Sure! I will do that

v-byte-cpu commented 3 years ago

Going forward, the plan is to keep the open API spec updated here:

https://github.com/typesense/typesense-api-spec/blob/master/openapi.yml

@kishorenc openapi.yml file is part of the project source code, and it must be in this repository for successful code generation (regardless of the life cycle of https://github.com/typesense/typesense-api-spec repository). Moreover, there were difficulties in unifying the openapi.yml file https://github.com/typesense/typesense-go/issues/70, so it is not possible now to reuse a shared file without modification.

kishorenc commented 3 years ago

openapi.yml file is part of the project source code, and it must be in this repository for successful code

👍

so it is not possible now to reuse a shared file without modification.

I presume that re-generating the Go client with the updated YML spec (with wrapper objects) would cause widespread changes? Here is the diff between the two versions: https://www.diffchecker.com/cVqE4Clr

I wonder if it will help in the longer run to just release a new version of the Go client with the structs with wrapper objects for the search params. This will ensure that we don't have to maintain 2 versions of the YML spec, even if a copy of the YML spec is also kept in the go lang repo. Happy to help with the migration -- please let me know what you think.

v-byte-cpu commented 3 years ago

@minarc I guess you also forgot to add the text_match field to the openapi.yml file