Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-daemon/cmd/generate-init-request.go
2498 views
1
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
//go:generate sh -c "cd .. && go run main.go generate init-request > initreq-schema.json"
6
7
package cmd
8
9
import (
10
"encoding/json"
11
"fmt"
12
13
"github.com/alecthomas/jsonschema"
14
"github.com/spf13/cobra"
15
16
"github.com/gitpod-io/gitpod/ws-daemon/api"
17
)
18
19
// generateInitReqSchemaCmd represents the generateConfig command
20
var generateInitReqSchemaCmd = &cobra.Command{
21
Use: "init-request",
22
Short: "Generates JSON schema for an init workspace request",
23
24
Run: func(cmd *cobra.Command, args []string) {
25
schema := jsonschema.Reflect(&api.InitWorkspaceRequest{})
26
27
schema.Title = "ws-manager config schema - generated using wsman generate init-request"
28
out, err := json.MarshalIndent(schema, "", " ")
29
if err != nil {
30
panic(err)
31
}
32
fmt.Print(string(out))
33
},
34
}
35
36
func init() {
37
generateCmd.AddCommand(generateInitReqSchemaCmd)
38
}
39
40