schema

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 8 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 ConnectionComponents added in v0.1.15

func ConnectionComponents() map[string]Schema

ConnectionComponents returns a standalone form schema for every known connection type. Types without tailored fields still receive the base form.

func JSON

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

JSON renders a schema as indented JSON.

func ProfileComponents added in v0.1.15

func ProfileComponents() map[string]Schema

ProfileComponents returns one standalone provider-form component per registered built-in profile provider.

func SchemaRefs added in v0.1.15

func SchemaRefs(dir string, components map[string]Schema) map[string]Schema

SchemaRefs keys component schemas by their relative external-ref path.

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 RedisProvider added in v0.1.15

type RedisProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=redis://host:6379/0"`
	// contains filtered or unexported fields
}

RedisProvider models a Redis/Valkey endpoint. A URL may carry the database number and credentials; explicit username/password fields override URI auth after hydration when the browser creates its client.

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 BrowserOptions added in v0.1.15

func BrowserOptions(typ string) Schema

BrowserOptions returns the provider-specific options form used when querying a saved connection. Endpoint and driver overrides are intentionally removed: a connection browser must remain scoped to the selected stored connection.

func Bundle added in v0.1.15

func Bundle(source Schema, refs map[string]Schema) (Schema, error)

Bundle rewrites the external refs in source to local #/$defs refs and embeds the referenced component documents. refs is keyed by the relative ref used in source (for example "connections/postgres.json").

func Connection

func Connection() Schema

Connection returns the bundled schema consumed by clicky-ui.

func ConnectionSource added in v0.1.15

func ConnectionSource() Schema

ConnectionSource returns the externally referenced connection schema graph. Bundle converts it to the self-contained document returned by Connection.

func Profile

func Profile() Schema

Profile returns the bundled profile schema consumed by clicky-ui.

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).

func ProfileSource added in v0.1.15

func ProfileSource() Schema

ProfileSource returns the externally referenced profile form schema. Each provider branch points at its standalone component under profiles/.

Jump to

Keyboard shortcuts

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