Skip to content
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

chore: Update doc tests #135

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
89 changes: 89 additions & 0 deletions jsonschema/docs/.snapshots/TestFileDestination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Table of contents

* [`Spec`](#Spec)
* [`Spec`](#Spec-1)
* [`Spec`](#Spec-2)
* [`Spec`](#Spec-3)
* [`Duration`](#Duration)

## <a name="Spec"></a>Spec

* `format` (`string`) (required) (possible values: `csv`, `json`, `parquet`)

Output format.

* `format_spec` ([`Spec`](#Spec-1), [`Spec`](#Spec-2) or [`Spec`](#Spec-3)) (nullable)

* `compression` (`string`) (possible values: ` `, `gzip`)

Compression type.
Empty or missing stands for no compression.

* `path` (`string`) (required)

Path template string that determines where files will be written.

The path supports the following placeholder variables:
- `{{TABLE}}` will be replaced with the table name
- `{{FORMAT}}` will be replaced with the file format, such as `csv`, `json` or `parquet`. If compression is enabled, the format will be `csv.gz`, `json.gz` etc.
- `{{UUID}}` will be replaced with a random UUID to uniquely identify each file
- `{{YEAR}}` will be replaced with the current year in `YYYY` format
- `{{MONTH}}` will be replaced with the current month in `MM` format
- `{{DAY}}` will be replaced with the current day in `DD` format
- `{{HOUR}}` will be replaced with the current hour in `HH` format
- `{{MINUTE}}` will be replaced with the current minute in `mm` format

**Note** that timestamps are in `UTC` and will be the current time at the time the file is written, not when the sync started.

* `no_rotate` (`boolean`) (default: `false`)

If set to `true`, the plugin will write to one file per table.
Otherwise, for every batch a new file will be created with a different `.<UUID>` suffix.

* `batch_size` (`integer`) (nullable) (range: `[1,+∞)`) (default: `10000`)

This parameter controls the maximum amount of items may be grouped together to be written in a single write.

Defaults to `10000` unless `no_rotate` is `true` (will be `0` then).

* `batch_size_bytes` (`integer`) (nullable) (range: `[1,+∞)`) (default: `52428800`)

This parameter controls the maximum size of items that may be grouped together to be written in a single write.

Defaults to `52428800` (50 MiB) unless `no_rotate` is `true` (will be `0` then).

* `batch_timeout` ([`Duration`](#Duration)) (nullable) (default: `30s`)

This parameter controls the maximum interval between batch writes.

Defaults to `30s` unless `no_rotate` is `true` (will be `0s` then).

### <a name="Spec-1"></a>Spec

CloudQuery CSV file output spec.

* `skip_header` (`boolean`) (default: `false`)

Specifies if the first line of a file should be the header.

* `delimiter` (`string`) ([pattern](https://json-schema.org/draft/2020-12/json-schema-validation#section-6.3.3): `^.$`) (default: `,`)

Character that will be used as the delimiter.

### <a name="Spec-2"></a>Spec

CloudQuery JSON file output spec.

(`object`)

### <a name="Spec-3"></a>Spec

CloudQuery Parquet file output spec.

(`object`)

### <a name="Duration"></a>Duration

CloudQuery configtype.Duration

(`string`) ([pattern](https://json-schema.org/draft/2020-12/json-schema-validation#section-6.3.3): `^[-+]?([0-9]*(\\.[0-9]*)?[a-z]+)+$`)
14 changes: 7 additions & 7 deletions jsonschema/docs/.snapshots/TestFiletypes.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Table of contents

* [`FileSpec`](#FileSpec)
* [`CSVSpec`](#CSVSpec)
* [`JSONSpec`](#JSONSpec)
* [`ParquetSpec`](#ParquetSpec)
* [`Spec`](#Spec)
* [`Spec`](#Spec-1)
* [`Spec`](#Spec-2)

## <a name="FileSpec"></a>FileSpec

* `format` (`string`) (required) (possible values: `csv`, `json`, `parquet`)

Output format.

* `format_spec` ([`CSVSpec`](#CSVSpec), [`JSONSpec`](#JSONSpec) or [`ParquetSpec`](#ParquetSpec)) (nullable)
* `format_spec` ([`Spec`](#Spec), [`Spec`](#Spec-1) or [`Spec`](#Spec-2)) (nullable)

* `compression` (`string`) (possible values: ` `, `gzip`)

Compression type.
Empty or missing stands for no compression.

### <a name="CSVSpec"></a>CSVSpec
### <a name="Spec"></a>Spec

CloudQuery CSV file output spec.

Expand All @@ -30,13 +30,13 @@

Character that will be used as the delimiter.

### <a name="JSONSpec"></a>JSONSpec
### <a name="Spec-1"></a>Spec

CloudQuery JSON file output spec.

(`object`)

### <a name="ParquetSpec"></a>ParquetSpec
### <a name="Spec-2"></a>Spec

CloudQuery Parquet file output spec.

Expand Down
4 changes: 4 additions & 0 deletions jsonschema/docs/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ func TestClickHouse(t *testing.T) {
func TestFiletypes(t *testing.T) {
genSnapshot(t, "testdata/filetypes.json")
}

func TestFileDestination(t *testing.T) {
genSnapshot(t, "testdata/file-destination.json")
}
Loading
Loading