Codegen: Render constraints in generated docs (#63196)

* Add constraints rendering

* Generate docs

* Fix constraint format

* Add type alias

* Compare numbers as strings

* fixup! Compare numbers as strings

* Add missing return
This commit is contained in:
Tania
2023-02-10 06:40:50 -05:00
committed by GitHub
parent 7f6a1c06a6
commit f0333ac41f
11 changed files with 131 additions and 45 deletions
@@ -17,12 +17,12 @@ A Grafana dashboard.
|------------------------|-----------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editable` | boolean | **Yes** | Whether a dashboard is editable or not. Default: `true`. |
| `graphTooltip` | integer | **Yes** | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. Default: `0`. |
| `revision` | integer | **Yes** | Version of the current dashboard data Default: `-1`. |
| `schemaVersion` | integer | **Yes** | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion Default: `36`. |
| `revision` | int64 | **Yes** | Version of the current dashboard data Default: `-1`. |
| `schemaVersion` | uint16 | **Yes** | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion Default: `36`. |
| `style` | string | **Yes** | Theme of dashboard.<br/>Possible values are: `dark`, `light`. Default: `dark`. |
| `annotations` | [object](#annotations) | No | TODO docs |
| `description` | string | No | Description of dashboard. |
| `fiscalYearStartMonth` | integer | No | The month that the fiscal year starts on. 0 = January, 11 = December Default: `0`. |
| `fiscalYearStartMonth` | integer | No | The month that the fiscal year starts on. 0 = January, 11 = December Default: `0`.<br/>Constraint: `>=0 & <12`. |
| `gnetId` | string | No | |
| `id` | integer | No | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? |
| `links` | [DashboardLink](#dashboardlink)[] | No | TODO docs |
@@ -37,7 +37,7 @@ A Grafana dashboard.
| `timezone` | string | No | Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". Default: `browser`. |
| `title` | string | No | Title of dashboard. |
| `uid` | string | No | Unique dashboard identifier that can be generated by anyone. string (8-40) |
| `version` | integer | No | Version of the dashboard, incremented each time the dashboard is updated. |
| `version` | uint32 | No | Version of the dashboard, incremented each time the dashboard is updated. |
| `weekStart` | string | No | TODO docs |
### DashboardLink
@@ -68,12 +68,12 @@ TODO docs
| `expires` | string | **Yes** | TODO docs |
| `externalUrl` | string | **Yes** | TODO docs |
| `external` | boolean | **Yes** | TODO docs |
| `id` | integer | **Yes** | TODO docs |
| `id` | uint32 | **Yes** | TODO docs |
| `key` | string | **Yes** | TODO docs |
| `name` | string | **Yes** | TODO docs |
| `orgId` | integer | **Yes** | TODO docs |
| `orgId` | uint32 | **Yes** | TODO docs |
| `updated` | string | **Yes** | TODO docs |
| `userId` | integer | **Yes** | TODO docs |
| `userId` | uint32 | **Yes** | TODO docs |
| `url` | string | No | TODO docs |
### Annotations
@@ -91,10 +91,10 @@ FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
| Property | Type | Required | Description |
|--------------|---------------------------------------|----------|-------------------------------------------------|
| `builtIn` | integer | **Yes** | Default: `0`. |
| `builtIn` | uint8 | **Yes** | Default: `0`. |
| `datasource` | [object](#datasource) | **Yes** | Datasource to use for annotation. |
| `enable` | boolean | **Yes** | Whether annotation is enabled. Default: `true`. |
| `showIn` | integer | **Yes** | Default: `0`. |
| `showIn` | uint8 | **Yes** | Default: `0`. |
| `type` | string | **Yes** | Default: `dashboard`. |
| `hide` | boolean | No | Whether to hide annotation. Default: `false`. |
| `iconColor` | string | No | Annotation icon color. |
@@ -147,7 +147,7 @@ TODO there appear to be a lot of different kinds of [template] vars here? if so
| `global` | boolean | **Yes** | Default: `false`. |
| `hide` | integer | **Yes** | Possible values are: `0`, `1`, `2`. |
| `id` | string | **Yes** | Default: `00000000-0000-0000-0000-000000000000`. |
| `index` | integer | **Yes** | Default: `-1`. |
| `index` | int32 | **Yes** | Default: `-1`. |
| `name` | string | **Yes** | |
| `skipUrlSync` | boolean | **Yes** | Default: `false`. |
| `state` | string | **Yes** | Possible values are: `NotStarted`, `Loading`, `Streaming`, `Done`, `Error`. |