Path: blob/main/components/ee/agent-smith/cmd/config-schema.go
2500 views
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package cmd56import (7"encoding/json"8"fmt"9"github.com/gitpod-io/gitpod/agent-smith/pkg/config"1011"github.com/alecthomas/jsonschema"12"github.com/gitpod-io/gitpod/common-go/log"13"github.com/spf13/cobra"14)1516// configSchemaCmd represents the configSchema command17var configSchemaCmd = &cobra.Command{18Use: "config-schema",19Short: "Generates the JSON schema validating the configuration",20Run: func(cmd *cobra.Command, args []string) {21schema := jsonschema.Reflect(&config.ServiceConfig{})22schema.Title = "agent-smith config schema - generated using agent-smith config-schema"23out, err := json.MarshalIndent(schema, "", " ")24if err != nil {25log.WithError(err).Fatal()26return27}28fmt.Print(string(out))29},30}3132func init() {33rootCmd.AddCommand(configSchemaCmd)34}353637