schema

package
v0.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package schema generates JSON Schema (Draft 2020-12) documents that drive the clicky-ui forms and tables of the query app:

  • Connection: a polymorphic if/then schema keyed on the connection `type`, so the connection form shows the right fields per backend.
  • Profile: the profile-setup schema for creating/editing a Profile.
  • ProfileInstance: a per-profile schema whose `properties` drive the FilterBar and whose `x-clicky-columns` drive the DataTable.

Schemas are assembled as plain maps (the same approach as the legacy schema emit) so the conditional envelopes stay explicit and dependency-free.

Index

Constants

View Source
const Draft = "https://json-schema.org/draft/2020-12/schema"

Draft is the JSON Schema dialect emitted by this package.

Variables

This section is empty.

Functions

func JSON

func JSON(s Schema) ([]byte, error)

JSON renders a schema as indented JSON.

func TailoredProviderTypes

func TailoredProviderTypes() map[string]struct{}

TailoredProviderTypes returns the set of connection types that get a tailored if/then branch. Exposed for the drift guard test.

Types

type ClickHouseProvider

type ClickHouseProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=clickhouse://user:pass@host:9000/db"`
	// contains filtered or unexported fields
}

ClickHouseProvider models a ClickHouse DSN connection.

type GCPKMSProvider

type GCPKMSProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
}

GCPKMSProvider models a Google Cloud KMS connection.

type GCPProvider

type GCPProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
}

GCPProvider models a Google Cloud connection: optional endpoint + the required service account JSON.

type GCSProvider

type GCSProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
}

GCSProvider models a Google Cloud Storage connection.

type GitProvider

type GitProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2"`

	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=SSH Private Key,source=secret,order=6"`
	// contains filtered or unexported fields
}

GitProvider models a Git repository connection: URL + basic-auth, or an SSH private key.

type HTTPProvider

type HTTPProvider struct {
	// contains filtered or unexported fields
}

HTTPProvider models a generic HTTP endpoint.

type JaegerProvider

type JaegerProvider struct {
	// contains filtered or unexported fields
}

JaegerProvider extends the HTTP form for a Jaeger query endpoint.

type KubernetesProvider

type KubernetesProvider struct {
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Kubeconfig,source=secret,order=6"`
}

KubernetesProvider models a Kubernetes cluster connection: an optional kubeconfig (in-cluster config is used when empty).

type LokiProvider

type LokiProvider struct {
	// contains filtered or unexported fields
}

LokiProvider extends the HTTP form for a Loki endpoint.

type MySQLProvider

type MySQLProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=user:pass@tcp(host:3306)/db"`
	// contains filtered or unexported fields
}

MySQLProvider models a MySQL DSN connection.

type OpenSearchProvider

type OpenSearchProvider struct {
	// contains filtered or unexported fields
}

OpenSearchProvider extends the HTTP form for an OpenSearch endpoint.

type PostgresProvider

type PostgresProvider struct {
	URL types.EnvVar `` /* 136-byte string literal not displayed */
	// contains filtered or unexported fields
}

PostgresProvider models a postgres SQL DSN connection.

type PrometheusProvider

type PrometheusProvider struct {
	// contains filtered or unexported fields
}

PrometheusProvider extends the HTTP form for a Prometheus endpoint.

type SQLServerProvider

type SQLServerProvider struct {
	URL types.EnvVar `` /* 130-byte string literal not displayed */
	// contains filtered or unexported fields
}

SQLServerProvider models a SQL Server DSN connection.

type Schema

type Schema = map[string]any

Schema is a JSON Schema document or subschema.

func Connection

func Connection() Schema

Connection returns the JSON Schema for the connection form. A minimal base (name/namespace/type/properties) is always present; an `allOf` of if/then branches keyed on `type` adds the per-type fields for the backends modelled in connection_providers.go, so the form adapts to the selected type. The `x-discriminator` hint tells clicky-ui to render the `type` picker (an icon grid, via x-enum-icons) first, then the matched type's form.

func Profile

func Profile() Schema

Profile returns the profile-setup JSON Schema used to create/edit a Profile.

func ProfileInstance

func ProfileInstance(p query.Profile) Schema

ProfileInstance returns a per-profile schema: the top-level `properties` describe the FilterBar inputs (from the profile's Params) and `x-clicky-columns` describes the DataTable (from the profile's Columns).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL