I would like to keep my Typesense schema definitio...
# community-help
n
I would like to keep my Typesense schema definition in a *.json file: it is easy to edit and is self-documenting. On the other hand: I am doing many manipulations from Java. And to create new collection in Java I have to build to the CollectionSchema, and do
client.collections().create(collectionSchema);
And... building CollectionSchema with Java API... is a lot of work and does not looks good... and to change it - you have to change the code... is difficult to handle... Can I have "best of both worlds"? To use JSON schema definition in Java API, something like this:
client.collections().createNewCollectionFromJsonFile(jsonFile)
k
Please create a feature request for this on the GitHub Java client repository.
n
Well, feature request takes time... I am thinking about hacking something... like making an additional method... like
<http://ApiCall.post|ApiCall.post>()
and
Collections.create()
but accepting String (JSON file content) instead of
CollectionSchema
... If it works and looks not too ugly - I can make a pull request. Classes
Collections
and
ApiCall
- they are not generated by Swagger, right?
k
Happy to accept a PR. Yes those classes are not auto generated.
n
Just build the project... uff... I would say, CONTRIBUTING.md should be improved. Steps I did (on Ubuntu): In the project directory:
Copy code
mkdir build
cd build
cp ../../typesense-api-spec/openapi.yml .
cd ..
mkdir data
typesense-server --data-dir ./data --api-key=xyz &
./gradlew build -x javadoc
have to exclude javadoc - otherwise i get an error...