Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f11461a
Update API reference documentation
peterbarnett03 Feb 3, 2025
4314589
feat(v3): WIP: Revise API specs for Core and Enterprise
jstirnaman Feb 5, 2025
f15d785
chore(monolith): Core HTTP API and OpenAPI .info content for Core and…
jstirnaman Feb 18, 2025
235b172
fix(api): Skip to next api-docs directory if the current dir doesn't …
jstirnaman Feb 18, 2025
0b7b73b
fix(ci): Remove Nightwatch dependency
jstirnaman Feb 19, 2025
b6adbbf
fix(api): Only call Google Tag Manager if hostname has influxdata.com…
jstirnaman Feb 19, 2025
846d3a9
fix(api): Update glossary links. Remove old cloud-serverless directory
jstirnaman Feb 21, 2025
b3bb9c4
feat(api): InfluxDB3 Core API reference, API fixes, and e2e tests
jstirnaman Feb 21, 2025
789c6fb
fix(api): Core: revise tags and tag-groups, add trait tags
jstirnaman Feb 25, 2025
f0245e3
feat(api-ref): API reference for Core and Enterprise
jstirnaman Feb 25, 2025
4194ef5
fix(api): Add shortDescription to replace summary
jstirnaman Feb 26, 2025
884bfd1
feat(api): Add Ask AI widget to API ref docs
jstirnaman Feb 26, 2025
bd93174
fix(api): confusing nav behavior with endpoints duplicated among tag …
jstirnaman Feb 26, 2025
b9de8b4
chore(ai): Add reminder to update the script in template.hbs
jstirnaman Feb 26, 2025
4887aa5
fix(api): links and headings in local API refs.
jstirnaman Feb 26, 2025
4403dd9
fix: LInks and headings. Replace `latest` with `v2`. Specify OSS v2 i…
jstirnaman Feb 27, 2025
40d2e0f
Apply suggestions from code review
jstirnaman Mar 4, 2025
5c19648
Update api-docs/influxdb3/enterprise/v3/ref.yml
jstirnaman Mar 4, 2025
ed42c1e
Update api-docs/influxdb3/core/v3/content/info.yml
jstirnaman Mar 4, 2025
1654d3c
Merge branch 'master' into core-enterprise-api-ref
jstirnaman Mar 4, 2025
6698e96
Merge branch 'master' into core-enterprise-api-ref
jstirnaman Mar 5, 2025
0b4d4a4
Update api-docs/influxdb3/core/v3/ref.yml
jstirnaman Mar 5, 2025
cb953b9
Apply suggestions from code review
jstirnaman Mar 5, 2025
7a1ad40
Update api-docs/influxdb3/core/v3/ref.yml
jstirnaman Mar 5, 2025
7502ede
Update api-docs/influxdb3/core/v3/ref.yml
jstirnaman Mar 5, 2025
632878d
Update api-docs/influxdb3/core/v3/ref.yml
jstirnaman Mar 5, 2025
09c3701
fix(v3): influxdb3/core/api, influxdb3/enterprise/api Port data flow …
jstirnaman Mar 6, 2025
e6dbb1c
Merge branch 'master' into core-enterprise-api-ref
jstirnaman Mar 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .ci/vale/styles/InfluxDB3-Core/Branding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: substitution
message: Did you mean '%s' instead of '%s'
level: warning
ignorecase: false
# swap maps tokens in form of bad: good
# NOTE: The left-hand (bad) side can match the right-hand (good) side;
# Vale ignores alerts that match the intended form.
swap:
'cloud-serverless|cloud-dedicated|clustered': core
'Cloud Serverless|Cloud Dedicated|Clustered': Core
'API token': database token
10 changes: 10 additions & 0 deletions .ci/vale/styles/InfluxDB3-Core/v3Schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends: substitution
message: Did you mean '%s' instead of '%s'
level: warning
ignorecase: false
# swap maps tokens in form of bad: good
# NOTE: The left-hand (bad) side can match the right-hand (good) side;
# Vale ignores alerts that match the intended form.
swap:
'(?i)bucket': database
'(?i)measurement': table
40 changes: 40 additions & 0 deletions .frontmatter-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Title of the page"
},
"description": {
"type": "string",
"description": "Page description that supports multi-line text"
},
"menu": {
"type": "object",
"properties": {
"influxdb3_core": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Menu item name"
}
},
"required": ["name"]
}
}
},
"weight": {
"type": "integer",
"description": "Order weight for menu items",
"minimum": 0
},
"source": {
"type": "string",
"description": "Path to source content file",
"pattern": "^/shared/.+\\.md$"
}
},
"required": ["title", "description", "menu", "weight"]
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node_modules
*.log
/resources
.hugo_build.lock
/content/influxdb/*/api/**/*.html
/content/influxdb*/**/api/**/*.html
/api-docs/redoc-static.html*
.vscode/*
.idea
Expand Down
15 changes: 14 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"vale.valeCLI.config": " \"${workspaceFolder}/.vale.ini\"",
"commentAnchors.tags.anchors":
{ "SOURCE": {
"scope": "file",
"behavior": "link",
"iconColor": "#FF0000",
"highlightColor": "#FF0000",
"style": "bold"
}},
"commentAnchors.workspace.matchFiles": "**/*.{md,ini,json,yaml,yml}",
"commentAnchors.workspace.enabled": true,
"yaml.schemas": {
"./.frontmatter-schema.json": "${workspaceFolder}/content/**/*.md"
},
"vale.valeCLI.config": "${workspaceFolder}/.vale.ini",
"vale.valeCLI.minAlertLevel": "warning",
}
30 changes: 20 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ To install dependencies listed in package.json:
4. Install the Yarn package manager and run `yarn` to install project dependencies.

`package.json` contains dependencies for linting and running Git hooks.
docs-v2 uses [Lefthook](https://github.com/evilmartians/lefthook) to configure and manage pre-commit hooks for linting and testing Markdown content.

Other dependencies used in the project:

- **[husky](https://github.com/typicode/husky)**: manages Git hooks, including the pre-commit hook for linting and testing
- **[lint-staged](https://github.com/lint-staged/lint-staged)**: passes staged files to commands
- **[prettier](https://prettier.io/docs/en/)**: formats code, including Markdown, according to style rules for consistency

### Install Docker
Expand All @@ -65,13 +66,24 @@ The tests defined in `compose.yaml` use the dependencies and execution
environment from this image.

```bash
docker build -t influxdata:docs-pytest -f Dockerfile.pytest .
docker build -t influxdata/docs-pytest:latest -f Dockerfile.pytest .
```

### Run the documentation locally (optional)

To run the documentation locally, follow the instructions provided in the README.

### Install Visual Studio Code extensions

If you use Microsoft Visual Studio (VS) Code, you can install extensions
to help you navigate, check, and edit files.

docs-v2 contains a `./.vscode/settings.json` that configures the following extensions:

- Comment Anchors: recognizes tags (for example, `//SOURCE`) and makes links and filepaths clickable in comments.
- Vale: shows linter errors and suggestions in the editor.
- YAML Schemas: validates frontmatter attributes.

### Make your changes

Make your suggested changes being sure to follow the [style and formatting guidelines](#style--formatting) outline below.
Expand All @@ -80,27 +92,25 @@ Make your suggested changes being sure to follow the [style and formatting guide

### Automatic pre-commit checks

docs-v2 uses Husky to manage Git hook scripts.
When you try to commit your changes (for example, `git commit`), Git runs
scripts configured in `.husky/pre-commit`, including linting and tests for your **staged** files.
docs-v2 uses Lefthook to manage Git hooks, such as pre-commit hooks that lint Markdown and test code blocks.
When you try to commit changes (`git commit`), Git runs
the commands configured in `lefthook.yml` which pass your **staged** files to Vale, Prettier, and Pytest (in a Docker container).

### Skip pre-commit hooks

**We strongly recommend running linting and tests**, but you can skip them
(and avoid installing dependencies)
by including the `HUSKY=0` environment variable or the `--no-verify` flag with
by including the `LEFTHOOK=0` environment variable or the `--no-verify` flag with
your commit--for example:

```sh
git commit -m "<COMMIT_MESSAGE>" --no-verify
```

```sh
HUSKY=0 git commit
LEFTHOOK=0 git commit
```

For more options, see the [Husky documentation](https://typicode.github.io/husky/how-to.html#skipping-git-hooks).

### Set up test scripts and credentials

To set up your docs-v2 instance to run tests locally, do the following:
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile.pytest
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
python3-venv \
rsync \
telegraf \
wget
wget \
yq

# Install InfluxDB 3 Core
RUN curl -O https://www.influxdata.com/d/install_influxdb3.sh \
&& chmod +x install_influxdb3.sh \
&& bash -c yes | ./install_influxdb3.sh

RUN ln -s /usr/bin/python3 /usr/bin/python

Expand Down
2 changes: 1 addition & 1 deletion api-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ InfluxDB Cloud releases are frequent and not versioned, so the Cloud API spec is
We regenerate API reference docs from `influxdata/openapi`
**master** branch as features are released.

### InfluxDB OSS version
### InfluxDB OSS v2 version

Given that
`influxdata/openapi` **master** may contain OSS spec changes not implemented
Expand Down
105 changes: 33 additions & 72 deletions api-docs/generate-api-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function generateHtml {
local productName="$3"
local api="$4"
local configPath="$5"
local isDefault=$6

# Use the product name to define the menu for the Hugo template
local menu="$(echo $productVersion | sed 's/\./_/g;s/-/_/g;s/\//_/g;')"
Expand All @@ -55,12 +54,23 @@ function generateHtml {
# Use the title and summary defined in the product API's info.yml file.
local title=$(yq '.title' $productVersion/$apiName/content/info.yml)
local menuTitle=$(yq '.x-influxdata-short-title' $productVersion/$apiName/content/info.yml)
local description=$(yq '.summary' $productVersion/$apiName/content/info.yml)
# Get the shortened description to use for metadata.
local shortDescription=$(yq '.x-influxdata-short-description' $productVersion/$apiName/content/info.yml)
# Get the aliases array from the configuration file.
local aliases=$(yq e ".apis | .$api | .x-influxdata-docs-aliases" "$configPath")
# If aliases is null, set it to an empty YAML array.
if [[ "$aliases" == "null" ]]; then
aliases='[]'
fi
local weight=102
if [[ $apiName == "v1-compatibility" ]]; then
weight=304
fi
# Define the file name for the Redoc HTML output.
local specbundle=redoc-static_index.html
# Define the temporary file for the Hugo template and Redoc HTML.
local tmpfile="${productVersion}-${api}_index.tmp"

echo "Bundling $specPath"

# Use npx to install and run the specified version of redoc-cli.
Expand All @@ -70,75 +80,31 @@ function generateHtml {
npm_config_yes=true npx [email protected] bundle $specPath \
--config $configPath \
-t template.hbs \
--title=$title \
--title="$title" \
--options.sortPropsAlphabetically \
--options.menuToggle \
--options.hideDownloadButton \
--options.hideHostname \
--options.noAutoAuth \
--output=$specbundle \
--templateOptions.description=$description \
--templateOptions.description="$shortDescription" \
--templateOptions.product="$productVersion" \
--templateOptions.productName="$productName"

if [[ $apiName == "v1-compatibility" ]]; then
frontmatter="---
title: $title
description: $description
layout: api
menu:
$menu:
parent: InfluxDB HTTP API
name: $menuTitle
identifier: api-reference-$apiName
weight: 304
aliases:
- /influxdb/$versionDir/api/v1/
---
"
elif [[ $apiVersion == "0" ]]; then
echo $productName $apiName
frontmatter="---
title: $title
description: $description
layout: api
weight: 102
menu:
$menu:
parent: InfluxDB HTTP API
name: $menuTitle
identifier: api-reference-$apiName
local frontmatter=$(yq eval -n \
".title = \"$title\" |
.description = \"$shortDescription\" |
.layout = \"api\" |
.weight = $weight |
.menu.[\"$menu\"].parent = \"InfluxDB HTTP API\" |
.menu.[\"$menu\"].name = \"$menuTitle\" |
.menu.[\"$menu\"].identifier = \"api-reference-$apiName\" |
.aliases = \"$aliases\"")

frontmatter="---
$frontmatter
---
"
elif [[ $isDefault == true ]]; then
frontmatter="---
title: $title
description: $description
layout: api
menu:
$menu:
parent: InfluxDB HTTP API
name: $menuTitle
identifier: api-reference-$apiName
weight: 102
aliases:
- /influxdb/$versionDir/api/
---
"
else
frontmatter="---
title: $title
description: $description
layout: api
menu:
$menu:
parent: InfluxDB HTTP API
name: $menuTitle
identifier: api-reference-$apiName
weight: 102
---
"
fi

# Create the Hugo template file with the frontmatter and Redoc HTML
echo "$frontmatter" >> $tmpfile
Expand Down Expand Up @@ -174,9 +140,10 @@ function build {
# Get the version API configuration file.
local configPath="$version/.config.yml"
if [ ! -f "$configPath" ]; then
configPath=".config.yml"
# Skip to the next version if the configuration file doesn't exist.
continue
fi
echo "Using config $configPath"
echo "Using config $version $configPath"
# Get the product name from the configuration.
local versionName
versionName=$(yq e '.x-influxdata-product-name' "$configPath")
Expand All @@ -198,13 +165,7 @@ function build {
if [ -d "$specPath" ] || [ ! -f "$specPath" ]; then
echo "OpenAPI spec $specPath doesn't exist."
fi
# Get default status from the configuration.
local isDefault=false
local defaultStatus
defaultStatus=$(yq e ".apis | .$api | .x-influxdata-default" "$configPath")
if [[ $defaultStatus == "true" ]]; then
isDefault=true
fi


# If the spec file differs from master, regenerate the HTML.
local update=0
Expand All @@ -218,9 +179,9 @@ function build {

if [[ $update -eq 0 ]]; then
echo "Regenerating $version $api"
generateHtml "$specPath" "$version" "$versionName" "$api" "$configPath" "$isDefault"
generateHtml "$specPath" "$version" "$versionName" "$api" "$configPath"
fi
echo "========Done with $version $api========"
echo -e "========Finished $version $api========\n\n"
done <<< "$apis"
done
}
Expand Down
Loading