Path: blob/main/components/ws-daemon/cmd/generate-init-request.go
2498 views
// Copyright (c) 2020 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.34//go:generate sh -c "cd .. && go run main.go generate init-request > initreq-schema.json"56package cmd78import (9"encoding/json"10"fmt"1112"github.com/alecthomas/jsonschema"13"github.com/spf13/cobra"1415"github.com/gitpod-io/gitpod/ws-daemon/api"16)1718// generateInitReqSchemaCmd represents the generateConfig command19var generateInitReqSchemaCmd = &cobra.Command{20Use: "init-request",21Short: "Generates JSON schema for an init workspace request",2223Run: func(cmd *cobra.Command, args []string) {24schema := jsonschema.Reflect(&api.InitWorkspaceRequest{})2526schema.Title = "ws-manager config schema - generated using wsman generate init-request"27out, err := json.MarshalIndent(schema, "", " ")28if err != nil {29panic(err)30}31fmt.Print(string(out))32},33}3435func init() {36generateCmd.AddCommand(generateInitReqSchemaCmd)37}383940