From 4588a19b4532ecce15b97b010e207f5ac6ce95e0 Mon Sep 17 00:00:00 2001 From: Kevin Franklin Kim Date: Fri, 4 Apr 2025 16:44:08 +0200 Subject: [PATCH] feat: add schema --- Makefile | 45 +- arbitrary/open/config.go | 14 +- arbitrary/open/config.schema.json | 94 ++ arbitrary/open/config_test.go | 40 + arbitrary/zip/config.schema.json | 46 + arbitrary/zip/config_test.go | 40 + azure/az/config.schema.json | 88 + azure/az/config_test.go | 40 + cloudflare/cloudflared/access.go | 6 +- cloudflare/cloudflared/config.go | 4 +- cloudflare/cloudflared/config.schema.json | 46 + cloudflare/cloudflared/config_test.go | 40 + config.schema.base.json | 120 ++ config.schema.json | 1732 ++++++++++++++++++++ config.yaml | 2 + digitalocean/doctl/config.schema.json | 38 + digitalocean/doctl/config_test.go | 40 + etcd-io/etcd/config.schema.json | 53 + etcd-io/etcd/config_test.go | 40 + facebook/docusaurus/config.schema.json | 42 + facebook/docusaurus/config_test.go | 40 + filosottile/mkcert/certificate.go | 4 +- filosottile/mkcert/config.go | 4 +- filosottile/mkcert/config.schema.json | 45 + filosottile/mkcert/config_test.go | 40 + foomo/beam/cluster.go | 6 +- foomo/beam/config.go | 4 +- foomo/beam/config.schema.json | 89 + foomo/beam/config_test.go | 40 + foomo/gocontentful/config.go | 8 +- foomo/gocontentful/config.schema.json | 33 + foomo/gocontentful/config_test.go | 40 + foomo/sesamy/config.schema.json | 16 + foomo/sesamy/config_test.go | 40 + foomo/squadron/cluster.go | 2 + foomo/squadron/config.schema.json | 59 + foomo/squadron/config_test.go | 40 + goharbor/harbor/config.schema.json | 27 + goharbor/harbor/config_test.go | 40 + golang-migrate/migrate/config.schema.json | 29 + golang-migrate/migrate/config_test.go | 40 + google/gcloud/config.schema.json | 101 ++ google/gcloud/config_test.go | 40 + grafana/k6/config.go | 4 +- grafana/k6/config.schema.json | 32 + grafana/k6/config_test.go | 40 + gravitational/teleport/config.schema.json | 75 + gravitational/teleport/config_test.go | 40 + gruntwork-io/terragrunt/config.schema.json | 23 + gruntwork-io/terragrunt/config_test.go | 40 + hashicorp/cdktf/config.schema.json | 23 + hashicorp/cdktf/config_test.go | 40 + jondot/hygen/config.go | 2 +- jondot/hygen/config.schema.json | 19 + jondot/hygen/config_test.go | 40 + k3d-io/k3d/config.schema.json | 98 ++ k3d-io/k3d/config_test.go | 40 + kubernets/kubectl/config.schema.json | 19 + kubernets/kubectl/config_test.go | 40 + onepassword/config.schema.json | 23 + onepassword/config_test.go | 40 + pivotal/licensefinder/config.schema.json | 30 + pivotal/licensefinder/config_test.go | 40 + pulumi/pulumi/azure/config.schema.json | 86 + pulumi/pulumi/azure/config_test.go | 40 + pulumi/pulumi/gcloud/config.schema.json | 78 + pulumi/pulumi/gcloud/config_test.go | 40 + rclone/rclone/config.schema.json | 23 + rclone/rclone/config_test.go | 40 + slack-go/slack/config.go | 6 +- slack-go/slack/config.schema.json | 57 + slack-go/slack/config_test.go | 40 + sqlc-dev/sqlc/config.schema.json | 23 + sqlc-dev/sqlc/config_test.go | 40 + stackitcloud/stackit/config.schema.json | 53 + stackitcloud/stackit/config_test.go | 40 + stern/stern/config.schema.json | 44 + stern/stern/config_test.go | 40 + usebruno/bruno/config.schema.json | 19 + usebruno/bruno/config_test.go | 40 + webdriverio/webdriverio/config.schema.json | 115 ++ webdriverio/webdriverio/config_test.go | 40 + 82 files changed, 4897 insertions(+), 32 deletions(-) create mode 100644 arbitrary/open/config.schema.json create mode 100644 arbitrary/open/config_test.go create mode 100644 arbitrary/zip/config.schema.json create mode 100644 arbitrary/zip/config_test.go create mode 100644 azure/az/config.schema.json create mode 100644 azure/az/config_test.go create mode 100644 cloudflare/cloudflared/config.schema.json create mode 100644 cloudflare/cloudflared/config_test.go create mode 100644 config.schema.base.json create mode 100644 config.schema.json create mode 100644 config.yaml create mode 100644 digitalocean/doctl/config.schema.json create mode 100644 digitalocean/doctl/config_test.go create mode 100644 etcd-io/etcd/config.schema.json create mode 100644 etcd-io/etcd/config_test.go create mode 100644 facebook/docusaurus/config.schema.json create mode 100644 facebook/docusaurus/config_test.go create mode 100644 filosottile/mkcert/config.schema.json create mode 100644 filosottile/mkcert/config_test.go create mode 100644 foomo/beam/config.schema.json create mode 100644 foomo/beam/config_test.go create mode 100644 foomo/gocontentful/config.schema.json create mode 100644 foomo/gocontentful/config_test.go create mode 100644 foomo/sesamy/config.schema.json create mode 100644 foomo/sesamy/config_test.go create mode 100644 foomo/squadron/config.schema.json create mode 100644 foomo/squadron/config_test.go create mode 100644 goharbor/harbor/config.schema.json create mode 100644 goharbor/harbor/config_test.go create mode 100644 golang-migrate/migrate/config.schema.json create mode 100644 golang-migrate/migrate/config_test.go create mode 100644 google/gcloud/config.schema.json create mode 100644 google/gcloud/config_test.go create mode 100644 grafana/k6/config.schema.json create mode 100644 grafana/k6/config_test.go create mode 100644 gravitational/teleport/config.schema.json create mode 100644 gravitational/teleport/config_test.go create mode 100644 gruntwork-io/terragrunt/config.schema.json create mode 100644 gruntwork-io/terragrunt/config_test.go create mode 100644 hashicorp/cdktf/config.schema.json create mode 100644 hashicorp/cdktf/config_test.go create mode 100644 jondot/hygen/config.schema.json create mode 100644 jondot/hygen/config_test.go create mode 100644 k3d-io/k3d/config.schema.json create mode 100644 k3d-io/k3d/config_test.go create mode 100644 kubernets/kubectl/config.schema.json create mode 100644 kubernets/kubectl/config_test.go create mode 100644 onepassword/config.schema.json create mode 100644 onepassword/config_test.go create mode 100644 pivotal/licensefinder/config.schema.json create mode 100644 pivotal/licensefinder/config_test.go create mode 100644 pulumi/pulumi/azure/config.schema.json create mode 100644 pulumi/pulumi/azure/config_test.go create mode 100644 pulumi/pulumi/gcloud/config.schema.json create mode 100644 pulumi/pulumi/gcloud/config_test.go create mode 100644 rclone/rclone/config.schema.json create mode 100644 rclone/rclone/config_test.go create mode 100644 slack-go/slack/config.schema.json create mode 100644 slack-go/slack/config_test.go create mode 100644 sqlc-dev/sqlc/config.schema.json create mode 100644 sqlc-dev/sqlc/config_test.go create mode 100644 stackitcloud/stackit/config.schema.json create mode 100644 stackitcloud/stackit/config_test.go create mode 100644 stern/stern/config.schema.json create mode 100644 stern/stern/config_test.go create mode 100644 usebruno/bruno/config.schema.json create mode 100644 usebruno/bruno/config_test.go create mode 100644 webdriverio/webdriverio/config.schema.json create mode 100644 webdriverio/webdriverio/config_test.go diff --git a/Makefile b/Makefile index e677a92..7d720fc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ .DEFAULT_GOAL:=help +-include .makerc + +export CGO_ENABLED=0 ## === Tasks === @@ -12,6 +15,46 @@ tidy: lint: @golangci-lint run +.PHONY: schema +## Run linter +schema: + @jsonschema bundle config.schema.base.json \ + --resolve ./arbitrary/open/config.schema.json \ + --resolve ./arbitrary/zip/config.schema.json \ + --resolve ./azure/az/config.schema.json \ + --resolve ./cloudflare/cloudflared/config.schema.json \ + --resolve ./digitalocean/doctl/config.schema.json \ + --resolve ./etcd-io/etcd/config.schema.json \ + --resolve ./facebook/docusaurus/config.schema.json \ + --resolve ./filosottile/mkcert/config.schema.json \ + --resolve ./foomo/beam/config.schema.json \ + --resolve ./foomo/gocontentful/config.schema.json \ + --resolve ./foomo/sesamy/config.schema.json \ + --resolve ./foomo/squadron/config.schema.json \ + --resolve ./goharbor/harbor/config.schema.json \ + --resolve ./golang-migrate/migrate/config.schema.json \ + --resolve ./google/gcloud/config.schema.json \ + --resolve ./grafana/k6/config.schema.json \ + --resolve ./gravitational/teleport/config.schema.json \ + --resolve ./gruntwork-io/terragrunt/config.schema.json \ + --resolve ./hashicorp/cdktf/config.schema.json \ + --resolve ./jondot/hygen/config.schema.json \ + --resolve ./k3d-io/k3d/config.schema.json \ + --resolve ./kubernets/kubectl/config.schema.json \ + --resolve ./onepassword/config.schema.json \ + --resolve ./pivotal/licensefinder/config.schema.json \ + --resolve ./pulumi/pulumi/azure/config.schema.json \ + --resolve ./pulumi/pulumi/gcloud/config.schema.json \ + --resolve ./rclone/rclone/config.schema.json \ + --resolve ./slack-go/slack/config.schema.json \ + --resolve ./sqlc-dev/sqlc/config.schema.json \ + --resolve ./stackitcloud/stackit/config.schema.json \ + --resolve ./stern/stern/config.schema.json \ + --resolve ./usebruno/bruno/config.schema.json \ + --resolve ./webdriverio/webdriverio/config.schema.json \ + --without-id \ + > config.schema.json + .PHONY: outdated ## Show outdated direct dependencies outdated: @@ -20,7 +63,7 @@ outdated: .PHONY: test ## Run tests test: - @go test -coverprofile=coverage.out -race -json ./... | gotestfmt + @GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -race -json ./... | gotestfmt .PHONY: lint.fix ## Fix lint violations diff --git a/arbitrary/open/config.go b/arbitrary/open/config.go index 67bb4ce..d924c4e 100644 --- a/arbitrary/open/config.go +++ b/arbitrary/open/config.go @@ -8,21 +8,21 @@ type ( Config map[string]ConfigRouter ConfigRouter struct { // Router base url - URL string `yaml:"url"` + URL string `json:"url" yaml:"url"` // Router Child routes - Routes map[string]ConfigRoute `yaml:"routes"` + Routes map[string]ConfigRoute `json:"routes" yaml:"routes"` // Router descriotion - Description string `yaml:"description"` + Description string `json:"description" yaml:"description"` } ConfigRoute struct { // Route path - Path string `yaml:"path"` + Path string `json:"path" yaml:"path"` // Route description - Description string `yaml:"description"` + Description string `json:"description" yaml:"description"` // Child routes - Routes map[string]ConfigRoute `yaml:"routes"` + Routes map[string]ConfigRoute `json:"routes" yaml:"routes"` // Basic authentication secret - BasicAuth *onepassword.Secret `yaml:"basicAuth"` + BasicAuth *onepassword.Secret `json:"basicAuth" yaml:"basicAuth"` } ) diff --git a/arbitrary/open/config.schema.json b/arbitrary/open/config.schema.json new file mode 100644 index 0000000..8812a51 --- /dev/null +++ b/arbitrary/open/config.schema.json @@ -0,0 +1,94 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/arbitrary/open/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "additionalProperties": { + "$ref": "#/$defs/ConfigRouter" + }, + "type": "object" + }, + "ConfigRoute": { + "properties": { + "path": { + "type": "string", + "description": "Route path" + }, + "description": { + "type": "string", + "description": "Route description" + }, + "routes": { + "additionalProperties": { + "$ref": "#/$defs/ConfigRoute" + }, + "type": "object", + "description": "Child routes" + }, + "basicAuth": { + "$ref": "#/$defs/Secret", + "description": "Basic authentication secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "description", + "routes", + "basicAuth" + ] + }, + "ConfigRouter": { + "properties": { + "url": { + "type": "string", + "description": "Router base url" + }, + "routes": { + "additionalProperties": { + "$ref": "#/$defs/ConfigRoute" + }, + "type": "object", + "description": "Router Child routes" + }, + "description": { + "type": "string", + "description": "Router descriotion" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "url", + "routes", + "description" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/arbitrary/open/config_test.go b/arbitrary/open/config_test.go new file mode 100644 index 0000000..d9e5834 --- /dev/null +++ b/arbitrary/open/config_test.go @@ -0,0 +1,40 @@ +package open_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/arbitrary/open" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/arbitrary/open", "./")) + schema := reflector.Reflect(&open.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/arbitrary/zip/config.schema.json b/arbitrary/zip/config.schema.json new file mode 100644 index 0000000..52283f2 --- /dev/null +++ b/arbitrary/zip/config.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/arbitrary/zip/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "credentials": { + "additionalProperties": { + "$ref": "#/$defs/Secret" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "credentials" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/arbitrary/zip/config_test.go b/arbitrary/zip/config_test.go new file mode 100644 index 0000000..c1347da --- /dev/null +++ b/arbitrary/zip/config_test.go @@ -0,0 +1,40 @@ +package zip_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/arbitrary/zip" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/arbitrary/zip", "./")) + schema := reflector.Reflect(&zip.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/azure/az/config.schema.json b/azure/az/config.schema.json new file mode 100644 index 0000000..7d580fc --- /dev/null +++ b/azure/az/config.schema.json @@ -0,0 +1,88 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/azure/az/config", + "$ref": "#/$defs/Config", + "$defs": { + "Artifactory": { + "properties": { + "name": { + "type": "string" + }, + "resourceGroup": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "resourceGroup" + ] + }, + "Cluster": { + "properties": { + "name": { + "type": "string", + "description": "Cluster" + }, + "resourceGroup": { + "type": "string", + "description": "Cluster resource group name" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "resourceGroup" + ] + }, + "Config": { + "properties": { + "configPath": { + "type": "string", + "description": "Config path" + }, + "subscriptions": { + "additionalProperties": { + "$ref": "#/$defs/Subscription" + }, + "type": "object", + "description": "Subscription configurations" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "configPath", + "subscriptions" + ] + }, + "Subscription": { + "properties": { + "name": { + "type": "string" + }, + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/Cluster" + }, + "type": "object" + }, + "artifactories": { + "additionalProperties": { + "$ref": "#/$defs/Artifactory" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "clusters", + "artifactories" + ] + } + } +} \ No newline at end of file diff --git a/azure/az/config_test.go b/azure/az/config_test.go new file mode 100644 index 0000000..2bd24e3 --- /dev/null +++ b/azure/az/config_test.go @@ -0,0 +1,40 @@ +package az_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/azure/az" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/azure/az", "./")) + schema := reflector.Reflect(&az.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/cloudflare/cloudflared/access.go b/cloudflare/cloudflared/access.go index 9b9dffe..cf08855 100644 --- a/cloudflare/cloudflared/access.go +++ b/cloudflare/cloudflared/access.go @@ -1,7 +1,7 @@ package cloudflared type Access struct { - Type string `yaml:"type"` - Hostname string `yaml:"hostname"` - Port int `yaml:"port"` + Type string `json:"type" yaml:"type"` + Hostname string `json:"hostname" yaml:"hostname"` + Port int `json:"port" yaml:"port"` } diff --git a/cloudflare/cloudflared/config.go b/cloudflare/cloudflared/config.go index 5c08fb1..9818156 100644 --- a/cloudflare/cloudflared/config.go +++ b/cloudflare/cloudflared/config.go @@ -7,8 +7,8 @@ import ( ) type Config struct { - Path string `yaml:"path"` - Access map[string]Access `yaml:"access"` + Path string `json:"path" yaml:"path"` + Access map[string]Access `json:"access" yaml:"access"` } func (c Config) AccessNames() []string { diff --git a/cloudflare/cloudflared/config.schema.json b/cloudflare/cloudflared/config.schema.json new file mode 100644 index 0000000..c23d9c8 --- /dev/null +++ b/cloudflare/cloudflared/config.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/cloudflare/cloudflared/config", + "$ref": "#/$defs/Config", + "$defs": { + "Access": { + "properties": { + "type": { + "type": "string" + }, + "hostname": { + "type": "string" + }, + "port": { + "type": "integer" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "type", + "hostname", + "port" + ] + }, + "Config": { + "properties": { + "path": { + "type": "string" + }, + "access": { + "additionalProperties": { + "$ref": "#/$defs/Access" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "access" + ] + } + } +} \ No newline at end of file diff --git a/cloudflare/cloudflared/config_test.go b/cloudflare/cloudflared/config_test.go new file mode 100644 index 0000000..f072de4 --- /dev/null +++ b/cloudflare/cloudflared/config_test.go @@ -0,0 +1,40 @@ +package cloudflared_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/cloudflare/cloudflared" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/cloudflare/cloudflared", "./")) + schema := reflector.Reflect(&cloudflared.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/config.schema.base.json b/config.schema.base.json new file mode 100644 index 0000000..71af337 --- /dev/null +++ b/config.schema.base.json @@ -0,0 +1,120 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-provider", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "version": { + "type": "string", + "pattern": "^[0-9]\\.[0-9]$", + "description": "Version of the schema" + }, + "rclone": { + "$ref": "https://github.com/foomo/posh-providers/rclone/rclone/config" + }, + "cdktf": { + "$ref": "https://github.com/foomo/posh-providers/hashicorp/cdktf/config" + }, + "az": { + "$ref": "https://github.com/foomo/posh-providers/azure/az/config" + }, + "gcloud": { + "$ref": "https://github.com/foomo/posh-providers/google/gcloud/config" + }, + "terragrunt": { + "$ref": "https://github.com/foomo/posh-providers/gruntwork-io/terragrunt/config" + }, + "doctl": { + "$ref": "https://github.com/foomo/posh-providers/digitalocean/doctl/config" + }, + "onepassword": { + "$ref": "https://github.com/foomo/posh-providers/onepassword/config" + }, + "cloudflared": { + "$ref": "https://github.com/foomo/posh-providers/cloudflare/cloudflared/config" + }, + "zip": { + "$ref": "https://github.com/foomo/posh-providers/arbitrary/zip/config" + }, + "open": { + "$ref": "https://github.com/foomo/posh-providers/arbitrary/open/config" + }, + "stern": { + "$ref": "https://github.com/foomo/posh-providers/stern/stern/config" + }, + "k6": { + "$ref": "https://github.com/foomo/posh-providers/grafana/k6/config" + }, + "k3d": { + "$ref": "https://github.com/foomo/posh-providers/k3d-io/k3d/config" + }, + "etcd": { + "$ref": "https://github.com/foomo/posh-providers/etcd-io/etcd/config" + }, + "hygen": { + "$ref": "https://github.com/foomo/posh-providers/jondot/hygen/config" + }, + "sqlc": { + "$ref": "https://github.com/foomo/posh-providers/sqlc-dev/sqlc/config" + }, + "mkcert": { + "$ref": "https://github.com/foomo/posh-providers/filosottile/mkcert/config" + }, + "licensefinder": { + "$ref": "https://github.com/foomo/posh-providers/pivotal/licensefinder/config" + }, + "docusaurus": { + "$ref": "https://github.com/foomo/posh-providers/facebook/docusaurus/config" + }, + "stackit": { + "$ref": "https://github.com/foomo/posh-providers/stackitcloud/stackit/config" + }, + "slack": { + "$ref": "https://github.com/foomo/posh-providers/slack-go/slack/config" + }, + "teleport": { + "$ref": "https://github.com/foomo/posh-providers/gravitational/teleport/config" + }, + "kubectl": { + "$ref": "https://github.com/foomo/posh-providers/kubernets/kubectl/config" + }, + "pulumi-gcloud": { + "$ref": "https://github.com/foomo/posh-providers/pulumi/pulumi/gcloud/config" + }, + "pulumi-azure": { + "$ref": "https://github.com/foomo/posh-providers/pulumi/pulumi/azure/config" + }, + "gocontentful": { + "$ref": "https://github.com/foomo/posh-providers/foomo/gocontentful/config" + }, + "beam": { + "$ref": "https://github.com/foomo/posh-providers/foomo/beam/config" + }, + "sesamy": { + "$ref": "https://github.com/foomo/posh-providers/foomo/sesamy/config" + }, + "squadron": { + "$ref": "https://github.com/foomo/posh-providers/foomo/squadron/config" + }, + "webdriverio": { + "$ref": "https://github.com/foomo/posh-providers/webdriverio/webdriverio/config" + }, + "migrate": { + "$ref": "https://github.com/foomo/posh-providers/golang-migrate/migrate/config" + }, + "bruno": { + "$ref": "https://github.com/foomo/posh-providers/usebruno/bruno/config" + }, + "harbor": { + "$ref": "https://github.com/foomo/posh-providers/goharbor/harbor/config" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "version" + ] + } + } +} diff --git a/config.schema.json b/config.schema.json new file mode 100644 index 0000000..c165ca1 --- /dev/null +++ b/config.schema.json @@ -0,0 +1,1732 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "version" + ], + "properties": { + "az": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1azure~1az~1config" + }, + "beam": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1beam~1config" + }, + "bruno": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1usebruno~1bruno~1config" + }, + "cdktf": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1hashicorp~1cdktf~1config" + }, + "cloudflared": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1cloudflare~1cloudflared~1config" + }, + "doctl": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1digitalocean~1doctl~1config" + }, + "docusaurus": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1facebook~1docusaurus~1config" + }, + "etcd": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1etcd-io~1etcd~1config" + }, + "gcloud": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1google~1gcloud~1config" + }, + "gocontentful": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1gocontentful~1config" + }, + "harbor": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1goharbor~1harbor~1config" + }, + "hygen": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1jondot~1hygen~1config" + }, + "k3d": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1k3d-io~1k3d~1config" + }, + "k6": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1grafana~1k6~1config" + }, + "kubectl": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1kubernets~1kubectl~1config" + }, + "licensefinder": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pivotal~1licensefinder~1config" + }, + "migrate": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1golang-migrate~1migrate~1config" + }, + "mkcert": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1filosottile~1mkcert~1config" + }, + "onepassword": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1onepassword~1config" + }, + "open": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config" + }, + "pulumi-azure": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1azure~1config" + }, + "pulumi-gcloud": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1gcloud~1config" + }, + "rclone": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1rclone~1rclone~1config" + }, + "sesamy": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1sesamy~1config" + }, + "slack": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1slack-go~1slack~1config" + }, + "sqlc": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1sqlc-dev~1sqlc~1config" + }, + "squadron": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1squadron~1config" + }, + "stackit": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stackitcloud~1stackit~1config" + }, + "stern": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stern~1stern~1config" + }, + "teleport": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gravitational~1teleport~1config" + }, + "terragrunt": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gruntwork-io~1terragrunt~1config" + }, + "version": { + "description": "Version of the schema", + "type": "string", + "pattern": "^[0-9]\\.[0-9]$" + }, + "webdriverio": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config" + }, + "zip": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1zip~1config" + } + }, + "additionalProperties": false + }, + "https://github.com/foomo/posh-providers/arbitrary/open/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config/$defs/ConfigRouter" + } + }, + "ConfigRoute": { + "type": "object", + "required": [ + "path", + "description", + "routes", + "basicAuth" + ], + "properties": { + "description": { + "description": "Route description", + "type": "string" + }, + "basicAuth": { + "description": "Basic authentication secret", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config/$defs/Secret" + }, + "path": { + "description": "Route path", + "type": "string" + }, + "routes": { + "description": "Child routes", + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config/$defs/ConfigRoute" + } + } + }, + "additionalProperties": false + }, + "ConfigRouter": { + "type": "object", + "required": [ + "url", + "routes", + "description" + ], + "properties": { + "description": { + "description": "Router descriotion", + "type": "string" + }, + "routes": { + "description": "Router Child routes", + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1open~1config/$defs/ConfigRoute" + } + }, + "url": { + "description": "Router base url", + "type": "string" + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/arbitrary/zip/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1zip~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "credentials" + ], + "properties": { + "credentials": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1arbitrary~1zip~1config/$defs/Secret" + } + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/azure/az/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1azure~1az~1config/$defs/Config", + "$defs": { + "Artifactory": { + "type": "object", + "required": [ + "name", + "resourceGroup" + ], + "properties": { + "name": { + "type": "string" + }, + "resourceGroup": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Cluster": { + "type": "object", + "required": [ + "name", + "resourceGroup" + ], + "properties": { + "name": { + "description": "Cluster", + "type": "string" + }, + "resourceGroup": { + "description": "Cluster resource group name", + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "configPath", + "subscriptions" + ], + "properties": { + "configPath": { + "description": "Config path", + "type": "string" + }, + "subscriptions": { + "description": "Subscription configurations", + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1azure~1az~1config/$defs/Subscription" + } + } + }, + "additionalProperties": false + }, + "Subscription": { + "type": "object", + "required": [ + "name", + "clusters", + "artifactories" + ], + "properties": { + "artifactories": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1azure~1az~1config/$defs/Artifactory" + } + }, + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1azure~1az~1config/$defs/Cluster" + } + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/cloudflare/cloudflared/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1cloudflare~1cloudflared~1config/$defs/Config", + "$defs": { + "Access": { + "type": "object", + "required": [ + "type", + "hostname", + "port" + ], + "properties": { + "type": { + "type": "string" + }, + "hostname": { + "type": "string" + }, + "port": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "path", + "access" + ], + "properties": { + "access": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1cloudflare~1cloudflared~1config/$defs/Access" + } + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/digitalocean/doctl/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1digitalocean~1doctl~1config/$defs/Config", + "$defs": { + "Cluster": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "configPath", + "clusters" + ], + "properties": { + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1digitalocean~1doctl~1config/$defs/Cluster" + } + }, + "configPath": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/etcd-io/etcd/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1etcd-io~1etcd~1config/$defs/Config", + "$defs": { + "Cluster": { + "type": "object", + "required": [ + "name", + "podName", + "namespace", + "paths" + ], + "properties": { + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "paths": { + "type": "array", + "items": { + "type": "string" + } + }, + "podName": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "configPath", + "clusters" + ], + "properties": { + "clusters": { + "type": "array", + "items": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1etcd-io~1etcd~1config/$defs/Cluster" + } + }, + "configPath": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/facebook/docusaurus/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1facebook~1docusaurus~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "sourcePath", + "localPort", + "nodeTag", + "imageTag", + "imageName", + "volumes" + ], + "properties": { + "imageName": { + "type": "string" + }, + "imageTag": { + "type": "string" + }, + "localPort": { + "type": "string" + }, + "nodeTag": { + "type": "string" + }, + "sourcePath": { + "type": "string" + }, + "volumes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/filosottile/mkcert/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1filosottile~1mkcert~1config/$defs/Config", + "$defs": { + "Certificate": { + "type": "object", + "required": [ + "name", + "names" + ], + "properties": { + "name": { + "type": "string" + }, + "names": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "certificatePath", + "certificates" + ], + "properties": { + "certificatePath": { + "type": "string" + }, + "certificates": { + "type": "array", + "items": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1filosottile~1mkcert~1config/$defs/Certificate" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/foomo/beam/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1beam~1config/$defs/Config", + "$defs": { + "Cluster": { + "type": "object", + "required": [ + "port", + "hostname", + "kubeconfig" + ], + "properties": { + "hostname": { + "type": "string" + }, + "kubeconfig": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1beam~1config/$defs/Secret" + }, + "port": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "clusters", + "databases" + ], + "properties": { + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1beam~1config/$defs/Cluster" + } + }, + "databases": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1beam~1config/$defs/Database" + } + } + }, + "additionalProperties": false + }, + "Database": { + "type": "object", + "required": [ + "port", + "hostname" + ], + "properties": { + "hostname": { + "type": "string" + }, + "port": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/foomo/gocontentful/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1gocontentful~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "spaceId", + "cmaKey", + "contentTypes" + ], + "properties": { + "cmaKey": { + "type": "string" + }, + "contentTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "environment": { + "type": "string" + }, + "spaceId": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/foomo/sesamy/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1sesamy~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "https://github.com/foomo/posh-providers/foomo/squadron/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1squadron~1config/$defs/Config", + "$defs": { + "Cluster": { + "type": "object", + "required": [ + "name", + "notify", + "confirm", + "fleets" + ], + "properties": { + "confirm": { + "description": "Enable confirmation", + "type": "boolean" + }, + "fleets": { + "description": "Cluster fleet names", + "type": "array", + "items": { + "type": "string" + } + }, + "name": { + "description": "Cluser name", + "type": "string" + }, + "notify": { + "description": "Enable notification by default", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "path", + "clusters" + ], + "properties": { + "clusters": { + "description": "Cluster configurations", + "type": "array", + "items": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1foomo~1squadron~1config/$defs/Cluster" + } + }, + "path": { + "description": "Path to the squadron root", + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/goharbor/harbor/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1goharbor~1harbor~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "url", + "authUrl", + "project" + ], + "properties": { + "authUrl": { + "type": "string" + }, + "project": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/golang-migrate/migrate/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1golang-migrate~1migrate~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "sources", + "databases" + ], + "properties": { + "databases": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "sources": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/google/gcloud/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1google~1gcloud~1config/$defs/Config", + "$defs": { + "Account": { + "type": "object", + "required": [ + "name", + "email", + "key" + ], + "properties": { + "email": { + "type": "string" + }, + "key": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1google~1gcloud~1config/$defs/Secret" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Cluster": { + "type": "object", + "required": [ + "name", + "project", + "region", + "account" + ], + "properties": { + "account": { + "type": "string" + }, + "name": { + "type": "string" + }, + "project": { + "type": "string" + }, + "region": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "configPath", + "accounts", + "clusters" + ], + "properties": { + "accounts": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1google~1gcloud~1config/$defs/Account" + } + }, + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1google~1gcloud~1config/$defs/Cluster" + } + }, + "configPath": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/grafana/k6/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1grafana~1k6~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path", + "envs" + ], + "properties": { + "envs": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1grafana~1k6~1config/$defs/Env" + } + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "https://github.com/foomo/posh-providers/gravitational/teleport/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gravitational~1teleport~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path", + "labels", + "hostname", + "kubernetes", + "apps", + "database" + ], + "properties": { + "apps": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "database": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gravitational~1teleport~1config/$defs/Database" + }, + "hostname": { + "type": "string" + }, + "kubernetes": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gravitational~1teleport~1config/$defs/Kubernetes" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Database": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Kubernetes": { + "type": "object", + "required": [ + "aliases" + ], + "properties": { + "aliases": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/gruntwork-io/terragrunt/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1gruntwork-io~1terragrunt~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path", + "cachePath" + ], + "properties": { + "cachePath": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/hashicorp/cdktf/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1hashicorp~1cdktf~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path", + "outPath" + ], + "properties": { + "outPath": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/jondot/hygen/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1jondot~1hygen~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "templatePath" + ], + "properties": { + "templatePath": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/k3d-io/k3d/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1k3d-io~1k3d~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "charts", + "registry", + "clusters" + ], + "properties": { + "charts": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1k3d-io~1k3d~1config/$defs/ConfigCharts" + }, + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1k3d-io~1k3d~1config/$defs/ConfigCluster" + } + }, + "registry": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1k3d-io~1k3d~1config/$defs/ConfigRegistry" + } + }, + "additionalProperties": false + }, + "ConfigCharts": { + "type": "object", + "required": [ + "path", + "prefix" + ], + "properties": { + "path": { + "type": "string" + }, + "prefix": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ConfigCluster": { + "type": "object", + "required": [ + "alias", + "image", + "port", + "enableTraefikRouter", + "args" + ], + "properties": { + "alias": { + "description": "K3d cluster name", + "type": "string" + }, + "args": { + "description": "Additional arguments", + "type": "array", + "items": { + "type": "string" + } + }, + "enableTraefikRouter": { + "description": "EnableTraefikRouter allows to create the cluster with the default traefik router", + "type": "boolean" + }, + "image": { + "description": "Docker image to use", + "type": "string" + }, + "port": { + "description": "Port to bind to", + "type": "string" + } + }, + "additionalProperties": false + }, + "ConfigRegistry": { + "type": "object", + "required": [ + "name", + "port" + ], + "properties": { + "name": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/kubernets/kubectl/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1kubernets~1kubectl~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "configPath" + ], + "properties": { + "configPath": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/onepassword/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1onepassword~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "account", + "tokenFilename" + ], + "properties": { + "account": { + "type": "string" + }, + "tokenFilename": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/pivotal/licensefinder/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pivotal~1licensefinder~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "logPath", + "decisionsPath", + "sources" + ], + "properties": { + "decisionsPath": { + "type": "string" + }, + "logPath": { + "type": "string" + }, + "sources": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/pulumi/pulumi/azure/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1azure~1config/$defs/Config", + "$defs": { + "Backend": { + "type": "object", + "required": [ + "location", + "container", + "subscription", + "resourceGroup", + "storageAccount", + "passphrase" + ], + "properties": { + "container": { + "type": "string" + }, + "location": { + "type": "string" + }, + "passphrase": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1azure~1config/$defs/Secret" + }, + "resourceGroup": { + "type": "string" + }, + "storageAccount": { + "type": "string" + }, + "subscription": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "path", + "configPath", + "backends" + ], + "properties": { + "backends": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1azure~1config/$defs/Backend" + } + }, + "configPath": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/pulumi/pulumi/gcloud/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1gcloud~1config/$defs/Config", + "$defs": { + "Backend": { + "type": "object", + "required": [ + "location", + "bucket", + "project", + "passphrase" + ], + "properties": { + "bucket": { + "type": "string" + }, + "location": { + "type": "string" + }, + "passphrase": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1gcloud~1config/$defs/Secret" + }, + "project": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "path", + "configPath", + "backends" + ], + "properties": { + "backends": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1pulumi~1pulumi~1gcloud~1config/$defs/Backend" + } + }, + "configPath": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/rclone/rclone/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1rclone~1rclone~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path", + "config" + ], + "properties": { + "config": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/slack-go/slack/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1slack-go~1slack~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "token", + "channels", + "webhooks" + ], + "properties": { + "channels": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "token": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1slack-go~1slack~1config/$defs/Secret" + }, + "webhooks": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1slack-go~1slack~1config/$defs/Secret" + } + } + }, + "additionalProperties": false + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/sqlc-dev/sqlc/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1sqlc-dev~1sqlc~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "tempDir", + "cacheDir" + ], + "properties": { + "cacheDir": { + "type": "string" + }, + "tempDir": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/stackitcloud/stackit/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stackitcloud~1stackit~1config/$defs/Config", + "$defs": { + "Cluster": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Config": { + "type": "object", + "required": [ + "projects" + ], + "properties": { + "projects": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stackitcloud~1stackit~1config/$defs/Project" + } + } + }, + "additionalProperties": false + }, + "Project": { + "type": "object", + "required": [ + "id", + "clusters" + ], + "properties": { + "id": { + "type": "string" + }, + "clusters": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stackitcloud~1stackit~1config/$defs/Cluster" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/stern/stern/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stern~1stern~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "queries" + ], + "properties": { + "queries": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stern~1stern~1config/$defs/Query" + } + } + }, + "additionalProperties": false + }, + "Query": { + "type": "object", + "required": [ + "query", + "queries" + ], + "properties": { + "queries": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1stern~1stern~1config/$defs/Query" + } + }, + "query": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/usebruno/bruno/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1usebruno~1bruno~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "https://github.com/foomo/posh-providers/webdriverio/webdriverio/config": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/Config", + "$defs": { + "Config": { + "type": "object", + "required": [ + "dirs", + "modes", + "sites", + "secrets", + "browserStack" + ], + "properties": { + "browserStack": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/Secret" + }, + "dirs": { + "type": "array", + "items": { + "type": "string" + } + }, + "modes": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/ConfigModes" + }, + "secrets": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/Secret" + } + }, + "sites": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/ConfigSites" + } + }, + "additionalProperties": false + }, + "ConfigEnv": { + "type": "object", + "required": [ + "auth", + "domain" + ], + "properties": { + "auth": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/Secret" + }, + "domain": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ConfigEnvs": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/ConfigEnv" + } + }, + "ConfigMode": { + "type": "object", + "required": [ + "port", + "hostPrefix" + ], + "properties": { + "hostPrefix": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "additionalProperties": false + }, + "ConfigModes": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/ConfigMode" + } + }, + "ConfigSites": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/https%3A~1~1github.com~1foomo~1posh-providers~1webdriverio~1webdriverio~1config/$defs/ConfigEnvs" + } + }, + "Secret": { + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ], + "properties": { + "account": { + "type": "string" + }, + "field": { + "type": "string" + }, + "item": { + "type": "string" + }, + "vault": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } +} diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..558dcb9 --- /dev/null +++ b/config.yaml @@ -0,0 +1,2 @@ +# yaml-language-server: $schema=config.schema.json +version: '1.0' diff --git a/digitalocean/doctl/config.schema.json b/digitalocean/doctl/config.schema.json new file mode 100644 index 0000000..b781d7d --- /dev/null +++ b/digitalocean/doctl/config.schema.json @@ -0,0 +1,38 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/digitalocean/doctl/config", + "$ref": "#/$defs/Config", + "$defs": { + "Cluster": { + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "Config": { + "properties": { + "configPath": { + "type": "string" + }, + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/Cluster" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "configPath", + "clusters" + ] + } + } +} \ No newline at end of file diff --git a/digitalocean/doctl/config_test.go b/digitalocean/doctl/config_test.go new file mode 100644 index 0000000..de9b38b --- /dev/null +++ b/digitalocean/doctl/config_test.go @@ -0,0 +1,40 @@ +package doctl_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/digitalocean/doctl" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/digitalocean/doctl", "./")) + schema := reflector.Reflect(&doctl.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/etcd-io/etcd/config.schema.json b/etcd-io/etcd/config.schema.json new file mode 100644 index 0000000..0b3bd26 --- /dev/null +++ b/etcd-io/etcd/config.schema.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/etcd-io/etcd/config", + "$ref": "#/$defs/Config", + "$defs": { + "Cluster": { + "properties": { + "name": { + "type": "string" + }, + "podName": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "paths": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "podName", + "namespace", + "paths" + ] + }, + "Config": { + "properties": { + "configPath": { + "type": "string" + }, + "clusters": { + "items": { + "$ref": "#/$defs/Cluster" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "configPath", + "clusters" + ] + } + } +} \ No newline at end of file diff --git a/etcd-io/etcd/config_test.go b/etcd-io/etcd/config_test.go new file mode 100644 index 0000000..4dd4d56 --- /dev/null +++ b/etcd-io/etcd/config_test.go @@ -0,0 +1,40 @@ +package etcd_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/etcd-io/etcd" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/etcd-io/etcd", "./")) + schema := reflector.Reflect(&etcd.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/facebook/docusaurus/config.schema.json b/facebook/docusaurus/config.schema.json new file mode 100644 index 0000000..03ac976 --- /dev/null +++ b/facebook/docusaurus/config.schema.json @@ -0,0 +1,42 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/facebook/docusaurus/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "sourcePath": { + "type": "string" + }, + "localPort": { + "type": "string" + }, + "nodeTag": { + "type": "string" + }, + "imageTag": { + "type": "string" + }, + "imageName": { + "type": "string" + }, + "volumes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "sourcePath", + "localPort", + "nodeTag", + "imageTag", + "imageName", + "volumes" + ] + } + } +} \ No newline at end of file diff --git a/facebook/docusaurus/config_test.go b/facebook/docusaurus/config_test.go new file mode 100644 index 0000000..a0e0fd8 --- /dev/null +++ b/facebook/docusaurus/config_test.go @@ -0,0 +1,40 @@ +package docusaurus_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/facebook/docusaurus" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/facebook/docusaurus", "./")) + schema := reflector.Reflect(&docusaurus.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/filosottile/mkcert/certificate.go b/filosottile/mkcert/certificate.go index 0845f60..6524ee4 100644 --- a/filosottile/mkcert/certificate.go +++ b/filosottile/mkcert/certificate.go @@ -1,6 +1,6 @@ package mkcert type Certificate struct { - Name string `yaml:"name"` - Names []string `yaml:"names"` + Name string `json:"name" yaml:"name"` + Names []string `json:"names" yaml:"names"` } diff --git a/filosottile/mkcert/config.go b/filosottile/mkcert/config.go index 9cc1d87..c5ff0e2 100644 --- a/filosottile/mkcert/config.go +++ b/filosottile/mkcert/config.go @@ -1,6 +1,6 @@ package mkcert type Config struct { - CertificatePath string `yaml:"certificatePath"` - Certificates []Certificate `yaml:"certificates"` + CertificatePath string `json:"certificatePath" yaml:"certificatePath"` + Certificates []Certificate `json:"certificates" yaml:"certificates"` } diff --git a/filosottile/mkcert/config.schema.json b/filosottile/mkcert/config.schema.json new file mode 100644 index 0000000..f5c2b49 --- /dev/null +++ b/filosottile/mkcert/config.schema.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/filosottile/mkcert/config", + "$ref": "#/$defs/Config", + "$defs": { + "Certificate": { + "properties": { + "name": { + "type": "string" + }, + "names": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "names" + ] + }, + "Config": { + "properties": { + "certificatePath": { + "type": "string" + }, + "certificates": { + "items": { + "$ref": "#/$defs/Certificate" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "certificatePath", + "certificates" + ] + } + } +} \ No newline at end of file diff --git a/filosottile/mkcert/config_test.go b/filosottile/mkcert/config_test.go new file mode 100644 index 0000000..075c797 --- /dev/null +++ b/filosottile/mkcert/config_test.go @@ -0,0 +1,40 @@ +package mkcert_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/filosottile/mkcert" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/filosottile/mkcert", "./")) + schema := reflector.Reflect(&mkcert.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/foomo/beam/cluster.go b/foomo/beam/cluster.go index 305a55a..899b853 100644 --- a/foomo/beam/cluster.go +++ b/foomo/beam/cluster.go @@ -5,7 +5,7 @@ import ( ) type Cluster struct { - Port int `yaml:"port"` - Hostname string `yaml:"hostname"` - Kubeconfig onepassword.Secret `yaml:"kubeconfig"` + Port int `json:"port" yaml:"port"` + Hostname string `json:"hostname" yaml:"hostname"` + Kubeconfig onepassword.Secret `json:"kubeconfig" yaml:"kubeconfig"` } diff --git a/foomo/beam/config.go b/foomo/beam/config.go index 9629d57..3070eaa 100644 --- a/foomo/beam/config.go +++ b/foomo/beam/config.go @@ -7,8 +7,8 @@ import ( ) type Config struct { - Clusters map[string]Cluster `yaml:"clusters"` - Databases map[string]Database `yaml:"databases"` + Clusters map[string]Cluster `json:"clusters" yaml:"clusters"` + Databases map[string]Database `json:"databases" yaml:"databases"` } func (c Config) GetDatabase(name string) Database { diff --git a/foomo/beam/config.schema.json b/foomo/beam/config.schema.json new file mode 100644 index 0000000..7d61434 --- /dev/null +++ b/foomo/beam/config.schema.json @@ -0,0 +1,89 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/foomo/beam/config", + "$ref": "#/$defs/Config", + "$defs": { + "Cluster": { + "properties": { + "port": { + "type": "integer" + }, + "hostname": { + "type": "string" + }, + "kubeconfig": { + "$ref": "#/$defs/Secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "port", + "hostname", + "kubeconfig" + ] + }, + "Config": { + "properties": { + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/Cluster" + }, + "type": "object" + }, + "databases": { + "additionalProperties": { + "$ref": "#/$defs/Database" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "clusters", + "databases" + ] + }, + "Database": { + "properties": { + "port": { + "type": "integer" + }, + "hostname": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "port", + "hostname" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/foomo/beam/config_test.go b/foomo/beam/config_test.go new file mode 100644 index 0000000..1ae33a6 --- /dev/null +++ b/foomo/beam/config_test.go @@ -0,0 +1,40 @@ +package beam_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/foomo/beam" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/beam", "./")) + schema := reflector.Reflect(&beam.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/foomo/gocontentful/config.go b/foomo/gocontentful/config.go index 29f4656..61b9c48 100644 --- a/foomo/gocontentful/config.go +++ b/foomo/gocontentful/config.go @@ -1,8 +1,8 @@ package gocontentful type Config struct { - SpaceID string `yaml:"spaceId"` - CMAKey string `yaml:"cmaKey"` - Environment string `yaml:"environment,omitempty"` - ContentTypes []string `yaml:"contentTypes"` + SpaceID string `json:"spaceId" yaml:"spaceId"` + CMAKey string `json:"cmaKey" yaml:"cmaKey"` + Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` + ContentTypes []string `json:"contentTypes" yaml:"contentTypes"` } diff --git a/foomo/gocontentful/config.schema.json b/foomo/gocontentful/config.schema.json new file mode 100644 index 0000000..a660ea6 --- /dev/null +++ b/foomo/gocontentful/config.schema.json @@ -0,0 +1,33 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/foomo/gocontentful/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "spaceId": { + "type": "string" + }, + "cmaKey": { + "type": "string" + }, + "environment": { + "type": "string" + }, + "contentTypes": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "spaceId", + "cmaKey", + "contentTypes" + ] + } + } +} \ No newline at end of file diff --git a/foomo/gocontentful/config_test.go b/foomo/gocontentful/config_test.go new file mode 100644 index 0000000..feb6dcd --- /dev/null +++ b/foomo/gocontentful/config_test.go @@ -0,0 +1,40 @@ +package gocontentful_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/foomo/gocontentful" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/gocontentful", "./")) + schema := reflector.Reflect(&gocontentful.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/foomo/sesamy/config.schema.json b/foomo/sesamy/config.schema.json new file mode 100644 index 0000000..da59377 --- /dev/null +++ b/foomo/sesamy/config.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/foomo/sesamy/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": "object" + } + } +} \ No newline at end of file diff --git a/foomo/sesamy/config_test.go b/foomo/sesamy/config_test.go new file mode 100644 index 0000000..acbc713 --- /dev/null +++ b/foomo/sesamy/config_test.go @@ -0,0 +1,40 @@ +package sesamy_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/foomo/sesamy" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/sesamy", "./")) + schema := reflector.Reflect(&sesamy.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/foomo/squadron/cluster.go b/foomo/squadron/cluster.go index bee1ce0..5b9df2d 100644 --- a/foomo/squadron/cluster.go +++ b/foomo/squadron/cluster.go @@ -5,6 +5,8 @@ type Cluster struct { Name string `json:"name" yaml:"name"` // Enable notification by default Notify bool `json:"notify" yaml:"notify"` + // Enable confirmation + Confirm bool `json:"confirm" yaml:"confirm"` // Cluster fleet names Fleets []string `json:"fleets" yaml:"fleets"` } diff --git a/foomo/squadron/config.schema.json b/foomo/squadron/config.schema.json new file mode 100644 index 0000000..9dc062e --- /dev/null +++ b/foomo/squadron/config.schema.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/foomo/squadron/config", + "$ref": "#/$defs/Config", + "$defs": { + "Cluster": { + "properties": { + "name": { + "type": "string", + "description": "Cluser name" + }, + "notify": { + "type": "boolean", + "description": "Enable notification by default" + }, + "confirm": { + "type": "boolean", + "description": "Enable confirmation" + }, + "fleets": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Cluster fleet names" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "notify", + "confirm", + "fleets" + ] + }, + "Config": { + "properties": { + "path": { + "type": "string", + "description": "Path to the squadron root" + }, + "clusters": { + "items": { + "$ref": "#/$defs/Cluster" + }, + "type": "array", + "description": "Cluster configurations" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "clusters" + ] + } + } +} \ No newline at end of file diff --git a/foomo/squadron/config_test.go b/foomo/squadron/config_test.go new file mode 100644 index 0000000..c2ba8bc --- /dev/null +++ b/foomo/squadron/config_test.go @@ -0,0 +1,40 @@ +package squadron_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/foomo/squadron" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/foomo/squadron", "./")) + schema := reflector.Reflect(&squadron.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/goharbor/harbor/config.schema.json b/goharbor/harbor/config.schema.json new file mode 100644 index 0000000..b6cad77 --- /dev/null +++ b/goharbor/harbor/config.schema.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/goharbor/harbor/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "url": { + "type": "string" + }, + "authUrl": { + "type": "string" + }, + "project": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "url", + "authUrl", + "project" + ] + } + } +} \ No newline at end of file diff --git a/goharbor/harbor/config_test.go b/goharbor/harbor/config_test.go new file mode 100644 index 0000000..17d7122 --- /dev/null +++ b/goharbor/harbor/config_test.go @@ -0,0 +1,40 @@ +package harbor_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/goharbor/harbor" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/goharbor/harbor", "./")) + schema := reflector.Reflect(&harbor.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/golang-migrate/migrate/config.schema.json b/golang-migrate/migrate/config.schema.json new file mode 100644 index 0000000..ce5897c --- /dev/null +++ b/golang-migrate/migrate/config.schema.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/golang-migrate/migrate/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "sources": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "databases": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "sources", + "databases" + ] + } + } +} \ No newline at end of file diff --git a/golang-migrate/migrate/config_test.go b/golang-migrate/migrate/config_test.go new file mode 100644 index 0000000..6d44b33 --- /dev/null +++ b/golang-migrate/migrate/config_test.go @@ -0,0 +1,40 @@ +package migrate_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/golang-migrate/migrate" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/golang-migrate/migrate", "./")) + schema := reflector.Reflect(&migrate.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/google/gcloud/config.schema.json b/google/gcloud/config.schema.json new file mode 100644 index 0000000..acc7244 --- /dev/null +++ b/google/gcloud/config.schema.json @@ -0,0 +1,101 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/google/gcloud/config", + "$ref": "#/$defs/Config", + "$defs": { + "Account": { + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "key": { + "$ref": "#/$defs/Secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "email", + "key" + ] + }, + "Cluster": { + "properties": { + "name": { + "type": "string" + }, + "project": { + "type": "string" + }, + "region": { + "type": "string" + }, + "account": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "project", + "region", + "account" + ] + }, + "Config": { + "properties": { + "configPath": { + "type": "string" + }, + "accounts": { + "additionalProperties": { + "$ref": "#/$defs/Account" + }, + "type": "object" + }, + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/Cluster" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "configPath", + "accounts", + "clusters" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/google/gcloud/config_test.go b/google/gcloud/config_test.go new file mode 100644 index 0000000..eaf520c --- /dev/null +++ b/google/gcloud/config_test.go @@ -0,0 +1,40 @@ +package gcloud_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/google/gcloud" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/google/gcloud", "./")) + schema := reflector.Reflect(&gcloud.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/grafana/k6/config.go b/grafana/k6/config.go index 1206a44..e6605fb 100644 --- a/grafana/k6/config.go +++ b/grafana/k6/config.go @@ -10,8 +10,8 @@ import ( ) type Config struct { - Path string `yaml:"path"` - Envs map[string]Env `yaml:"envs"` + Path string `json:"path" yaml:"path"` + Envs map[string]Env `json:"envs" yaml:"envs"` } func (c Config) Env(name string) Env { diff --git a/grafana/k6/config.schema.json b/grafana/k6/config.schema.json new file mode 100644 index 0000000..76f7339 --- /dev/null +++ b/grafana/k6/config.schema.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/grafana/k6/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + }, + "envs": { + "additionalProperties": { + "$ref": "#/$defs/Env" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "envs" + ] + }, + "Env": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + } +} \ No newline at end of file diff --git a/grafana/k6/config_test.go b/grafana/k6/config_test.go new file mode 100644 index 0000000..0a6da93 --- /dev/null +++ b/grafana/k6/config_test.go @@ -0,0 +1,40 @@ +package k6_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/grafana/k6" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/grafana/k6", "./")) + schema := reflector.Reflect(&k6.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/gravitational/teleport/config.schema.json b/gravitational/teleport/config.schema.json new file mode 100644 index 0000000..d92ed57 --- /dev/null +++ b/gravitational/teleport/config.schema.json @@ -0,0 +1,75 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/gravitational/teleport/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + }, + "labels": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "hostname": { + "type": "string" + }, + "kubernetes": { + "$ref": "#/$defs/Kubernetes" + }, + "apps": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": "object" + }, + "database": { + "$ref": "#/$defs/Database" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "labels", + "hostname", + "kubernetes", + "apps", + "database" + ] + }, + "Database": { + "properties": { + "user": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "user" + ] + }, + "Kubernetes": { + "properties": { + "aliases": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "aliases" + ] + } + } +} \ No newline at end of file diff --git a/gravitational/teleport/config_test.go b/gravitational/teleport/config_test.go new file mode 100644 index 0000000..711d7a6 --- /dev/null +++ b/gravitational/teleport/config_test.go @@ -0,0 +1,40 @@ +package teleport_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/gravitational/teleport" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/gravitational/teleport", "./")) + schema := reflector.Reflect(&teleport.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/gruntwork-io/terragrunt/config.schema.json b/gruntwork-io/terragrunt/config.schema.json new file mode 100644 index 0000000..3c92cac --- /dev/null +++ b/gruntwork-io/terragrunt/config.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/gruntwork-io/terragrunt/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + }, + "cachePath": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "cachePath" + ] + } + } +} \ No newline at end of file diff --git a/gruntwork-io/terragrunt/config_test.go b/gruntwork-io/terragrunt/config_test.go new file mode 100644 index 0000000..4dff280 --- /dev/null +++ b/gruntwork-io/terragrunt/config_test.go @@ -0,0 +1,40 @@ +package terragrunt_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/gruntwork-io/terragrunt" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/gruntwork-io/terragrunt", "./")) + schema := reflector.Reflect(&terragrunt.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/hashicorp/cdktf/config.schema.json b/hashicorp/cdktf/config.schema.json new file mode 100644 index 0000000..e5f5329 --- /dev/null +++ b/hashicorp/cdktf/config.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/hashicorp/cdktf/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + }, + "outPath": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "outPath" + ] + } + } +} \ No newline at end of file diff --git a/hashicorp/cdktf/config_test.go b/hashicorp/cdktf/config_test.go new file mode 100644 index 0000000..e15a436 --- /dev/null +++ b/hashicorp/cdktf/config_test.go @@ -0,0 +1,40 @@ +package cdktf_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/hashicorp/cdktf" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/hashicorp/cdktf", "./")) + schema := reflector.Reflect(&cdktf.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/jondot/hygen/config.go b/jondot/hygen/config.go index c2ef54e..e960cfa 100644 --- a/jondot/hygen/config.go +++ b/jondot/hygen/config.go @@ -1,5 +1,5 @@ package hygen type Config struct { - TemplatePath string `yaml:"templatePath"` + TemplatePath string `json:"templatePath" yaml:"templatePath"` } diff --git a/jondot/hygen/config.schema.json b/jondot/hygen/config.schema.json new file mode 100644 index 0000000..bfb3d1a --- /dev/null +++ b/jondot/hygen/config.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/jondot/hygen/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "templatePath": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "templatePath" + ] + } + } +} \ No newline at end of file diff --git a/jondot/hygen/config_test.go b/jondot/hygen/config_test.go new file mode 100644 index 0000000..b3aa7e7 --- /dev/null +++ b/jondot/hygen/config_test.go @@ -0,0 +1,40 @@ +package hygen_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/jondot/hygen" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/jondot/hygen", "./")) + schema := reflector.Reflect(&hygen.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/k3d-io/k3d/config.schema.json b/k3d-io/k3d/config.schema.json new file mode 100644 index 0000000..0714d57 --- /dev/null +++ b/k3d-io/k3d/config.schema.json @@ -0,0 +1,98 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/k3d-io/k3d/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "charts": { + "$ref": "#/$defs/ConfigCharts" + }, + "registry": { + "$ref": "#/$defs/ConfigRegistry" + }, + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/ConfigCluster" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "charts", + "registry", + "clusters" + ] + }, + "ConfigCharts": { + "properties": { + "path": { + "type": "string" + }, + "prefix": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "prefix" + ] + }, + "ConfigCluster": { + "properties": { + "alias": { + "type": "string", + "description": "K3d cluster name" + }, + "image": { + "type": "string", + "description": "Docker image to use" + }, + "port": { + "type": "string", + "description": "Port to bind to" + }, + "enableTraefikRouter": { + "type": "boolean", + "description": "EnableTraefikRouter allows to create the cluster with the default traefik router" + }, + "args": { + "items": { + "type": "string" + }, + "type": "array", + "description": "Additional arguments" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "alias", + "image", + "port", + "enableTraefikRouter", + "args" + ] + }, + "ConfigRegistry": { + "properties": { + "name": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name", + "port" + ] + } + } +} \ No newline at end of file diff --git a/k3d-io/k3d/config_test.go b/k3d-io/k3d/config_test.go new file mode 100644 index 0000000..0712877 --- /dev/null +++ b/k3d-io/k3d/config_test.go @@ -0,0 +1,40 @@ +package k3d_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/k3d-io/k3d" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/k3d-io/k3d", "./")) + schema := reflector.Reflect(&k3d.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/kubernets/kubectl/config.schema.json b/kubernets/kubectl/config.schema.json new file mode 100644 index 0000000..573c626 --- /dev/null +++ b/kubernets/kubectl/config.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/kubernets/kubectl/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "configPath": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "configPath" + ] + } + } +} \ No newline at end of file diff --git a/kubernets/kubectl/config_test.go b/kubernets/kubectl/config_test.go new file mode 100644 index 0000000..69ad358 --- /dev/null +++ b/kubernets/kubectl/config_test.go @@ -0,0 +1,40 @@ +package kubectl_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/kubernets/kubectl" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/kubernets/kubectl", "./")) + schema := reflector.Reflect(&kubectl.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/onepassword/config.schema.json b/onepassword/config.schema.json new file mode 100644 index 0000000..08e66c5 --- /dev/null +++ b/onepassword/config.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/onepassword/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "account": { + "type": "string" + }, + "tokenFilename": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "tokenFilename" + ] + } + } +} \ No newline at end of file diff --git a/onepassword/config_test.go b/onepassword/config_test.go new file mode 100644 index 0000000..35b6162 --- /dev/null +++ b/onepassword/config_test.go @@ -0,0 +1,40 @@ +package onepassword_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/onepassword" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/onepassword", "./")) + schema := reflector.Reflect(&onepassword.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/pivotal/licensefinder/config.schema.json b/pivotal/licensefinder/config.schema.json new file mode 100644 index 0000000..2f00966 --- /dev/null +++ b/pivotal/licensefinder/config.schema.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/pivotal/licensefinder/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "logPath": { + "type": "string" + }, + "decisionsPath": { + "type": "string" + }, + "sources": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "logPath", + "decisionsPath", + "sources" + ] + } + } +} \ No newline at end of file diff --git a/pivotal/licensefinder/config_test.go b/pivotal/licensefinder/config_test.go new file mode 100644 index 0000000..2bbe067 --- /dev/null +++ b/pivotal/licensefinder/config_test.go @@ -0,0 +1,40 @@ +package licensefinder_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/pivotal/licensefinder" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pivotal/licensefinder", "./")) + schema := reflector.Reflect(&licensefinder.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/pulumi/pulumi/azure/config.schema.json b/pulumi/pulumi/azure/config.schema.json new file mode 100644 index 0000000..474b7a3 --- /dev/null +++ b/pulumi/pulumi/azure/config.schema.json @@ -0,0 +1,86 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/pulumi/pulumi/azure/config", + "$ref": "#/$defs/Config", + "$defs": { + "Backend": { + "properties": { + "location": { + "type": "string" + }, + "container": { + "type": "string" + }, + "subscription": { + "type": "string" + }, + "resourceGroup": { + "type": "string" + }, + "storageAccount": { + "type": "string" + }, + "passphrase": { + "$ref": "#/$defs/Secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "location", + "container", + "subscription", + "resourceGroup", + "storageAccount", + "passphrase" + ] + }, + "Config": { + "properties": { + "path": { + "type": "string" + }, + "configPath": { + "type": "string" + }, + "backends": { + "additionalProperties": { + "$ref": "#/$defs/Backend" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "configPath", + "backends" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/pulumi/pulumi/azure/config_test.go b/pulumi/pulumi/azure/config_test.go new file mode 100644 index 0000000..0ac5bff --- /dev/null +++ b/pulumi/pulumi/azure/config_test.go @@ -0,0 +1,40 @@ +package pulumi_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/pulumi/pulumi/azure" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pulumi/pulumi/azure", "./")) + schema := reflector.Reflect(&pulumi.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/pulumi/pulumi/gcloud/config.schema.json b/pulumi/pulumi/gcloud/config.schema.json new file mode 100644 index 0000000..a365b6c --- /dev/null +++ b/pulumi/pulumi/gcloud/config.schema.json @@ -0,0 +1,78 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/pulumi/pulumi/gcloud/config", + "$ref": "#/$defs/Config", + "$defs": { + "Backend": { + "properties": { + "location": { + "type": "string" + }, + "bucket": { + "type": "string" + }, + "project": { + "type": "string" + }, + "passphrase": { + "$ref": "#/$defs/Secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "location", + "bucket", + "project", + "passphrase" + ] + }, + "Config": { + "properties": { + "path": { + "type": "string" + }, + "configPath": { + "type": "string" + }, + "backends": { + "additionalProperties": { + "$ref": "#/$defs/Backend" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "configPath", + "backends" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/pulumi/pulumi/gcloud/config_test.go b/pulumi/pulumi/gcloud/config_test.go new file mode 100644 index 0000000..97d49ff --- /dev/null +++ b/pulumi/pulumi/gcloud/config_test.go @@ -0,0 +1,40 @@ +package pulumi_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/pulumi/pulumi/gcloud" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/pulumi/pulumi/gcloud", "./")) + schema := reflector.Reflect(&pulumi.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/rclone/rclone/config.schema.json b/rclone/rclone/config.schema.json new file mode 100644 index 0000000..457dda9 --- /dev/null +++ b/rclone/rclone/config.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/rclone/rclone/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + }, + "config": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path", + "config" + ] + } + } +} \ No newline at end of file diff --git a/rclone/rclone/config_test.go b/rclone/rclone/config_test.go new file mode 100644 index 0000000..15e06d3 --- /dev/null +++ b/rclone/rclone/config_test.go @@ -0,0 +1,40 @@ +package rclone_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/rclone/rclone" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/rclone/rclone", "./")) + schema := reflector.Reflect(&rclone.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/slack-go/slack/config.go b/slack-go/slack/config.go index 7f41314..368bd6a 100644 --- a/slack-go/slack/config.go +++ b/slack-go/slack/config.go @@ -5,7 +5,7 @@ import ( ) type Config struct { - Token onepassword.Secret `yaml:"token"` - Channels map[string]string `yaml:"channels"` - Webhooks map[string]onepassword.Secret `yaml:"webhooks"` + Token onepassword.Secret `json:"token" yaml:"token"` + Channels map[string]string `json:"channels" yaml:"channels"` + Webhooks map[string]onepassword.Secret `json:"webhooks" yaml:"webhooks"` } diff --git a/slack-go/slack/config.schema.json b/slack-go/slack/config.schema.json new file mode 100644 index 0000000..9d2bb2b --- /dev/null +++ b/slack-go/slack/config.schema.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/slack-go/slack/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "token": { + "$ref": "#/$defs/Secret" + }, + "channels": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "webhooks": { + "additionalProperties": { + "$ref": "#/$defs/Secret" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "token", + "channels", + "webhooks" + ] + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/slack-go/slack/config_test.go b/slack-go/slack/config_test.go new file mode 100644 index 0000000..5b34cd6 --- /dev/null +++ b/slack-go/slack/config_test.go @@ -0,0 +1,40 @@ +package slack_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/slack-go/slack" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/slack-go/slack", "./")) + schema := reflector.Reflect(&slack.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/sqlc-dev/sqlc/config.schema.json b/sqlc-dev/sqlc/config.schema.json new file mode 100644 index 0000000..2679530 --- /dev/null +++ b/sqlc-dev/sqlc/config.schema.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/sqlc-dev/sqlc/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "tempDir": { + "type": "string" + }, + "cacheDir": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "tempDir", + "cacheDir" + ] + } + } +} \ No newline at end of file diff --git a/sqlc-dev/sqlc/config_test.go b/sqlc-dev/sqlc/config_test.go new file mode 100644 index 0000000..d2446a7 --- /dev/null +++ b/sqlc-dev/sqlc/config_test.go @@ -0,0 +1,40 @@ +package sqlc_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/sqlc-dev/sqlc" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/sqlc-dev/sqlc", "./")) + schema := reflector.Reflect(&sqlc.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/stackitcloud/stackit/config.schema.json b/stackitcloud/stackit/config.schema.json new file mode 100644 index 0000000..a8c8105 --- /dev/null +++ b/stackitcloud/stackit/config.schema.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/stackitcloud/stackit/config", + "$ref": "#/$defs/Config", + "$defs": { + "Cluster": { + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "Config": { + "properties": { + "projects": { + "additionalProperties": { + "$ref": "#/$defs/Project" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "projects" + ] + }, + "Project": { + "properties": { + "id": { + "type": "string" + }, + "clusters": { + "additionalProperties": { + "$ref": "#/$defs/Cluster" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "id", + "clusters" + ] + } + } +} \ No newline at end of file diff --git a/stackitcloud/stackit/config_test.go b/stackitcloud/stackit/config_test.go new file mode 100644 index 0000000..80b835c --- /dev/null +++ b/stackitcloud/stackit/config_test.go @@ -0,0 +1,40 @@ +package stackit_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/stackitcloud/stackit" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/stackitcloud/stackit", "./")) + schema := reflector.Reflect(&stackit.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/stern/stern/config.schema.json b/stern/stern/config.schema.json new file mode 100644 index 0000000..265fd68 --- /dev/null +++ b/stern/stern/config.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/stern/stern/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "queries": { + "additionalProperties": { + "$ref": "#/$defs/Query" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "queries" + ] + }, + "Query": { + "properties": { + "query": { + "items": { + "type": "string" + }, + "type": "array" + }, + "queries": { + "additionalProperties": { + "$ref": "#/$defs/Query" + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "query", + "queries" + ] + } + } +} \ No newline at end of file diff --git a/stern/stern/config_test.go b/stern/stern/config_test.go new file mode 100644 index 0000000..00fb33a --- /dev/null +++ b/stern/stern/config_test.go @@ -0,0 +1,40 @@ +package stern_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/stern/stern" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/stern/stern", "./")) + schema := reflector.Reflect(&stern.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/usebruno/bruno/config.schema.json b/usebruno/bruno/config.schema.json new file mode 100644 index 0000000..51578fd --- /dev/null +++ b/usebruno/bruno/config.schema.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/usebruno/bruno/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "path" + ] + } + } +} \ No newline at end of file diff --git a/usebruno/bruno/config_test.go b/usebruno/bruno/config_test.go new file mode 100644 index 0000000..62e9611 --- /dev/null +++ b/usebruno/bruno/config_test.go @@ -0,0 +1,40 @@ +package bruno_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/usebruno/bruno" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/usebruno/bruno", "./")) + schema := reflector.Reflect(&bruno.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +} diff --git a/webdriverio/webdriverio/config.schema.json b/webdriverio/webdriverio/config.schema.json new file mode 100644 index 0000000..ba8d8ba --- /dev/null +++ b/webdriverio/webdriverio/config.schema.json @@ -0,0 +1,115 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/foomo/posh-providers/webdriverio/webdriverio/config", + "$ref": "#/$defs/Config", + "$defs": { + "Config": { + "properties": { + "dirs": { + "items": { + "type": "string" + }, + "type": "array" + }, + "modes": { + "$ref": "#/$defs/ConfigModes" + }, + "sites": { + "$ref": "#/$defs/ConfigSites" + }, + "secrets": { + "additionalProperties": { + "$ref": "#/$defs/Secret" + }, + "type": "object" + }, + "browserStack": { + "$ref": "#/$defs/Secret" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "dirs", + "modes", + "sites", + "secrets", + "browserStack" + ] + }, + "ConfigEnv": { + "properties": { + "auth": { + "$ref": "#/$defs/Secret" + }, + "domain": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "auth", + "domain" + ] + }, + "ConfigEnvs": { + "additionalProperties": { + "$ref": "#/$defs/ConfigEnv" + }, + "type": "object" + }, + "ConfigMode": { + "properties": { + "port": { + "type": "string" + }, + "hostPrefix": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "port", + "hostPrefix" + ] + }, + "ConfigModes": { + "additionalProperties": { + "$ref": "#/$defs/ConfigMode" + }, + "type": "object" + }, + "ConfigSites": { + "additionalProperties": { + "$ref": "#/$defs/ConfigEnvs" + }, + "type": "object" + }, + "Secret": { + "properties": { + "account": { + "type": "string" + }, + "vault": { + "type": "string" + }, + "item": { + "type": "string" + }, + "field": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "account", + "vault", + "item", + "field" + ] + } + } +} \ No newline at end of file diff --git a/webdriverio/webdriverio/config_test.go b/webdriverio/webdriverio/config_test.go new file mode 100644 index 0000000..7d98335 --- /dev/null +++ b/webdriverio/webdriverio/config_test.go @@ -0,0 +1,40 @@ +package webdriverio_test + +import ( + "encoding/json" + "os" + "path" + "testing" + + testingx "github.com/foomo/go/testing" + tagx "github.com/foomo/go/testing/tag" + "github.com/foomo/posh-providers/webdriverio/webdriverio" + "github.com/invopop/jsonschema" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestConfig(t *testing.T) { + t.Parallel() + testingx.Tags(t, tagx.Short) + + cwd, err := os.Getwd() + require.NoError(t, err) + + reflector := new(jsonschema.Reflector) + require.NoError(t, reflector.AddGoComments("github.com/foomo/posh-providers/webdriverio/webdriverio", "./")) + schema := reflector.Reflect(&webdriverio.Config{}) + actual, err := json.MarshalIndent(schema, "", " ") + require.NoError(t, err) + + filename := path.Join(cwd, "config.schema.json") + expected, err := os.ReadFile(filename) + if !errors.Is(err, os.ErrNotExist) { + require.NoError(t, err) + } + + if !assert.Equal(t, string(expected), string(actual)) { + require.NoError(t, os.WriteFile(filename, actual, 0600)) + } +}