Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Generate doc from json schema #7275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

NamanMahor
Copy link
Contributor

@NamanMahor NamanMahor commented May 6, 2025

Closes #1640

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@NamanMahor NamanMahor requested a review from begelundmuller May 6, 2025 20:56
@NamanMahor NamanMahor self-assigned this May 6, 2025
Copy link
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also:

  1. Fix the lint errors on the PR
  2. Make sure the docs compile correctly so I can check how it renders 😄 You test with npm run dev --workspace docs
Screenshot 2025-05-07 at 12 14 36 Screenshot 2025-05-07 at 12 15 07

@NamanMahor NamanMahor requested a review from begelundmuller May 7, 2025 12:28
Copy link
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some inline comments below. But here are two overall comments when looking at the docs

  1. Can we use some kind of heading tags for the different properties? Or at least the top-level properties.
    • The reason for this is that it will be very useful to be able to link directly to a property, so we want to output headings with an id="property_name" tag so we can get <url>#property_name links directly to the properties.
  2. When properties have oneofs, the layout becomes quite flat and it can be difficult to find out what they relate to. I'm wondering if different sizes, spacing or indentation could somehow make this easier to read. Maybe headings for top level properties would be enough. For example, see this screenshot:
Screenshot 2025-05-08 at 22 16 52

Comment on lines +247 to +264
// orderedMapToYAMLNode recursively converts an orderedmap.OrderedMap to a yaml.Node
// It treats keys starting with "_comment_" as comments.
func orderedMapToYAMLNode(m orderedmap.OrderedMap) (*yaml.Node, error) {
node := &yaml.Node{
Kind: yaml.MappingNode,
}

var pendingComment string
for _, key := range m.Keys() {
value, _ := m.Get(key)

// Check if the key is a comment (starts with "_comment_")
if strings.HasPrefix(key, "_comment_") {
if strVal, ok := value.(string); ok {
pendingComment = strVal
}
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a normal way of doing examples in JSON Schema? It seems a little hard to read/edit when looking in the JSON.

We don't necessarily need examples in the JSON schema itself. We can have them in separate example docs instead.

Comment on lines +9 to +29
## Properties


**`type`** - _[string]_ - Refers to the resource type and must be `alert` _(required)_

**`name`** - _[string]_ - Name is usually inferred from the filename, but can be specified manually.

**`refs`** - _[array of oneOf]_ - List of resource references, each as a string or map.

*option 1* - _[object]_ - An object reference with at least a `<name>` and `<type>`.

- **`type`** - _[string]_ - type of resource

- **`name`** - _[string]_ - name of resource _(required)_

*option 2* - _[string]_ - A string reference like `<resource-name>` or `<type/resource-name>`.

**`dev`** - _[object]_ - Overrides properties in development

**`prod`** - _[object]_ - Overrides properties in production

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to have the common properties in a separate ## Common properties section of each page?

Comment on lines +16 to +24
**`refs`** - _[array of oneOf]_ - List of resource references, each as a string or map.

*option 1* - _[object]_ - An object reference with at least a `<name>` and `<type>`.

- **`type`** - _[string]_ - type of resource

- **`name`** - _[string]_ - name of resource _(required)_

*option 2* - _[string]_ - A string reference like `<resource-name>` or `<type/resource-name>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make option 2 the only documented option in the schema? And keep option 1 as an internal implementation detail. Every time the feature has been used, we have used option 2.

Comment on lines +32 to +36
**`refresh`** - _[object]_ - Specifies the refresh schedule that Rill should follow to re-ingest and update the underlying data _(required)_

- **`cron`** - _[string]_ - A cron expression that defines the execution schedule

- **`every`** - _[string]_ - Run at a fixed interval using a Go duration string (e.g., '1h', '30m', '24h'). See: https://pkg.go.dev/time#ParseDuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove every from the docs – we're probably going to deprecate it, and always use cron

Comment on lines +227 to +247
### clickhouse



**`connector`** - _[string]_ _(required)_

**`path`** - _[string]_ - Path to the data source.

**`format`** - _[string]_ - Format of the data source (e.g., csv, json, parquet).

**`managed`** - _[boolean]_ - `true` means Rill will provision the connector using the default provisioner. `false` disables automatic provisioning.

**`dsn`** - _[string]_ - DSN(Data Source Name) for the ClickHouse connection

**`username`** - _[string]_ - Username for authentication

**`password`** - _[string]_ - Password for authentication

**`host`** - _[string]_ - Host where the ClickHouse instance is running

**`port`** - _[integer]_ - Port where the ClickHouse instance is accessible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The properties listed here are for type: connector, not type: model. Models have fields like sql: and output: incremental_strategy, etc.

Comment on lines +1 to +3
---
note: GENERATED. DO NOT EDIT.
title: Explore Dashboard YAML
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call the file explore.yaml – every file name should match the type: <name> identifier so it's predictable to link to

Comment on lines +1 to +6
---
note: GENERATED. DO NOT EDIT.
title: New Project files
sidebar_position: 30
---
## Overview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you call this YAML Syntax and the path docs/reference/yaml/index.md? So it doesn't conflict with the current "Project files" section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants