Skip to content

Commit

Permalink
update readme and curl snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
generall committed May 14, 2024
1 parent b905c34 commit 3ddaced
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
YQ_VERSION=v4.44.1
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O yq
chmod +x yq
mv yq /usr/local/bin
- name: Sync Docs
run: |
bash -x tools/sync-openapi.sh
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,26 @@ Click [here](https://qdrant.docs.buildwithfern.com/api-reference) to see the gen
- [Docs Configuration](./fern/docs.yml)
- [GitHub Workflows](./.github/workflows)

## How to update documentation?
## How to sync OpenAPI specs?

Either manually, by rinning the script:

```bash
bash -x tools/sync-openapi.sh
```

WARN: This script requires `yq` and `python` to be present in the system.

Or automatically, triggering the GitHub Action `sync-openapi` from the Actions tab.

## How to update snippets?

The source of truth for the snippets is located in `snippets` folder, edit it there.
File names should match the `operationId` of the OpenAPI spec.

After edited, follow the `How to sync OpenAPI specs?` steps and it will be automatically updated for the latest version of the API.

## How to deploy documentation live?

To update your documentation, run

Expand Down
21 changes: 21 additions & 0 deletions snippets/curl/create_collection.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Minimal curl command to create a collection with a vector field

curl -X PUT http://localhost:6333/collections/collection_name \
-H "api-key: <apiKey>" \
-H "Content-Type: application/json" \
Expand All @@ -7,3 +9,22 @@ curl -X PUT http://localhost:6333/collections/collection_name \
"distance": "Cosine"
}
}'

# Or with a sparse vector field

curl -X PUT http://localhost:6333/collections/collection_name \
-H "api-key: <apiKey>" \
-H "Content-Type: application/json" \
-d '{
"vectors": {
"size": 300,
"distance": "Cosine"
},
"sparse_vectors": {
"splade-model-name": {
"index": {
"on_disk": true
}
}
}
}'
4 changes: 2 additions & 2 deletions tools/sync-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ python tools/generate_snippet_overwrites.py --openapi qdrant/docs/redoc/master/o

# Merge the overwrites with the template

./yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' fern/openapi-overrides-template.yml overwrite-snippets.yml > $PROJECT_ROOT/fern/apis/master/openapi-overrides.yml
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' fern/openapi-overrides-template.yml overwrite-snippets.yml > $PROJECT_ROOT/fern/apis/master/openapi-overrides.yml

# Find latest version inside the repository `docs/redoc` starting with `v*`

Expand Down Expand Up @@ -80,6 +80,6 @@ done

# Join the versions with the existing docs.yml using `yq`

./yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' $PROJECT_ROOT/fern/docs.yml $VERSIONS_TMP_YAML > $PROJECT_ROOT/fern/docs.tmp.yml
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' $PROJECT_ROOT/fern/docs.yml $VERSIONS_TMP_YAML > $PROJECT_ROOT/fern/docs.tmp.yml

mv $PROJECT_ROOT/fern/docs.tmp.yml $PROJECT_ROOT/fern/docs.yml

0 comments on commit 3ddaced

Please sign in to comment.