feat: add schema

This commit is contained in:
Kevin Franklin Kim 2025-04-04 16:44:08 +02:00
parent eaa5cceffd
commit 4588a19b45
No known key found for this signature in database
82 changed files with 4897 additions and 32 deletions

View File

@ -1,4 +1,7 @@
.DEFAULT_GOAL:=help .DEFAULT_GOAL:=help
-include .makerc
export CGO_ENABLED=0
## === Tasks === ## === Tasks ===
@ -12,6 +15,46 @@ tidy:
lint: lint:
@golangci-lint run @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 .PHONY: outdated
## Show outdated direct dependencies ## Show outdated direct dependencies
outdated: outdated:
@ -20,7 +63,7 @@ outdated:
.PHONY: test .PHONY: test
## Run tests ## Run tests
test: test:
@go test -coverprofile=coverage.out -race -json ./... | gotestfmt @GO_TEST_TAGS=-skip go test -coverprofile=coverage.out -race -json ./... | gotestfmt
.PHONY: lint.fix .PHONY: lint.fix
## Fix lint violations ## Fix lint violations

View File

@ -8,21 +8,21 @@ type (
Config map[string]ConfigRouter Config map[string]ConfigRouter
ConfigRouter struct { ConfigRouter struct {
// Router base url // Router base url
URL string `yaml:"url"` URL string `json:"url" yaml:"url"`
// Router Child routes // Router Child routes
Routes map[string]ConfigRoute `yaml:"routes"` Routes map[string]ConfigRoute `json:"routes" yaml:"routes"`
// Router descriotion // Router descriotion
Description string `yaml:"description"` Description string `json:"description" yaml:"description"`
} }
ConfigRoute struct { ConfigRoute struct {
// Route path // Route path
Path string `yaml:"path"` Path string `json:"path" yaml:"path"`
// Route description // Route description
Description string `yaml:"description"` Description string `json:"description" yaml:"description"`
// Child routes // Child routes
Routes map[string]ConfigRoute `yaml:"routes"` Routes map[string]ConfigRoute `json:"routes" yaml:"routes"`
// Basic authentication secret // Basic authentication secret
BasicAuth *onepassword.Secret `yaml:"basicAuth"` BasicAuth *onepassword.Secret `json:"basicAuth" yaml:"basicAuth"`
} }
) )

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

40
azure/az/config_test.go Normal file
View File

@ -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))
}
}

View File

@ -1,7 +1,7 @@
package cloudflared package cloudflared
type Access struct { type Access struct {
Type string `yaml:"type"` Type string `json:"type" yaml:"type"`
Hostname string `yaml:"hostname"` Hostname string `json:"hostname" yaml:"hostname"`
Port int `yaml:"port"` Port int `json:"port" yaml:"port"`
} }

View File

@ -7,8 +7,8 @@ import (
) )
type Config struct { type Config struct {
Path string `yaml:"path"` Path string `json:"path" yaml:"path"`
Access map[string]Access `yaml:"access"` Access map[string]Access `json:"access" yaml:"access"`
} }
func (c Config) AccessNames() []string { func (c Config) AccessNames() []string {

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

120
config.schema.base.json Normal file
View File

@ -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"
]
}
}
}

1732
config.schema.json Normal file

File diff suppressed because it is too large Load Diff

2
config.yaml Normal file
View File

@ -0,0 +1,2 @@
# yaml-language-server: $schema=config.schema.json
version: '1.0'

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -1,6 +1,6 @@
package mkcert package mkcert
type Certificate struct { type Certificate struct {
Name string `yaml:"name"` Name string `json:"name" yaml:"name"`
Names []string `yaml:"names"` Names []string `json:"names" yaml:"names"`
} }

View File

@ -1,6 +1,6 @@
package mkcert package mkcert
type Config struct { type Config struct {
CertificatePath string `yaml:"certificatePath"` CertificatePath string `json:"certificatePath" yaml:"certificatePath"`
Certificates []Certificate `yaml:"certificates"` Certificates []Certificate `json:"certificates" yaml:"certificates"`
} }

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -5,7 +5,7 @@ import (
) )
type Cluster struct { type Cluster struct {
Port int `yaml:"port"` Port int `json:"port" yaml:"port"`
Hostname string `yaml:"hostname"` Hostname string `json:"hostname" yaml:"hostname"`
Kubeconfig onepassword.Secret `yaml:"kubeconfig"` Kubeconfig onepassword.Secret `json:"kubeconfig" yaml:"kubeconfig"`
} }

View File

@ -7,8 +7,8 @@ import (
) )
type Config struct { type Config struct {
Clusters map[string]Cluster `yaml:"clusters"` Clusters map[string]Cluster `json:"clusters" yaml:"clusters"`
Databases map[string]Database `yaml:"databases"` Databases map[string]Database `json:"databases" yaml:"databases"`
} }
func (c Config) GetDatabase(name string) Database { func (c Config) GetDatabase(name string) Database {

View File

@ -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"
]
}
}
}

40
foomo/beam/config_test.go Normal file
View File

@ -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))
}
}

View File

@ -1,8 +1,8 @@
package gocontentful package gocontentful
type Config struct { type Config struct {
SpaceID string `yaml:"spaceId"` SpaceID string `json:"spaceId" yaml:"spaceId"`
CMAKey string `yaml:"cmaKey"` CMAKey string `json:"cmaKey" yaml:"cmaKey"`
Environment string `yaml:"environment,omitempty"` Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
ContentTypes []string `yaml:"contentTypes"` ContentTypes []string `json:"contentTypes" yaml:"contentTypes"`
} }

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
}
}
}

View File

@ -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))
}
}

View File

@ -5,6 +5,8 @@ type Cluster struct {
Name string `json:"name" yaml:"name"` Name string `json:"name" yaml:"name"`
// Enable notification by default // Enable notification by default
Notify bool `json:"notify" yaml:"notify"` Notify bool `json:"notify" yaml:"notify"`
// Enable confirmation
Confirm bool `json:"confirm" yaml:"confirm"`
// Cluster fleet names // Cluster fleet names
Fleets []string `json:"fleets" yaml:"fleets"` Fleets []string `json:"fleets" yaml:"fleets"`
} }

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -10,8 +10,8 @@ import (
) )
type Config struct { type Config struct {
Path string `yaml:"path"` Path string `json:"path" yaml:"path"`
Envs map[string]Env `yaml:"envs"` Envs map[string]Env `json:"envs" yaml:"envs"`
} }
func (c Config) Env(name string) Env { func (c Config) Env(name string) Env {

View File

@ -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"
}
}
}

40
grafana/k6/config_test.go Normal file
View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -1,5 +1,5 @@
package hygen package hygen
type Config struct { type Config struct {
TemplatePath string `yaml:"templatePath"` TemplatePath string `json:"templatePath" yaml:"templatePath"`
} }

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

40
k3d-io/k3d/config_test.go Normal file
View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -5,7 +5,7 @@ import (
) )
type Config struct { type Config struct {
Token onepassword.Secret `yaml:"token"` Token onepassword.Secret `json:"token" yaml:"token"`
Channels map[string]string `yaml:"channels"` Channels map[string]string `json:"channels" yaml:"channels"`
Webhooks map[string]onepassword.Secret `yaml:"webhooks"` Webhooks map[string]onepassword.Secret `json:"webhooks" yaml:"webhooks"`
} }

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}

View File

@ -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"
]
}
}
}

View File

@ -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))
}
}