Skip to content

Commit 4cb1131

Browse files
committed
docs: update
1 parent 36a1faa commit 4cb1131

8 files changed

Lines changed: 1422 additions & 1603 deletions

File tree

docs/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,5 @@ go run ./docs/hack/config/partials/main.go
4545
```bash
4646
cd ../ # main project directory
4747

48-
# JSON Schema:
49-
go run ./docs/hack/config/schema/main.go >docs/schemas/config-jsonschema.json
50-
51-
# Open API Spec:
52-
go run ./docs/hack/config/schema/main.go true >docs/schemas/config-openapi.json
48+
go run ./docs/hack/config/schemas/main.go
5349
```
Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6+
"io/ioutil"
67
"os"
8+
"path/filepath"
79
"strings"
810

911
"github.com/invopop/jsonschema"
1012
"github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
1113
)
1214

15+
const jsonschemaFile = "docs/schemas/config-jsonschema.json"
16+
const openapiSchemaFile = "docs/schemas/config-openapi.json"
17+
1318
// Run executes the command logic
1419
func main() {
15-
mustGenerateOpenAPISpec := len(os.Args) > 1 && os.Args[1] == "true"
16-
prefix := ""
17-
if mustGenerateOpenAPISpec {
18-
prefix = " "
19-
}
20-
2120
r := new(jsonschema.Reflector)
2221
r.AllowAdditionalProperties = true
2322
r.PreferYAMLSchema = true
@@ -32,17 +31,27 @@ func main() {
3231

3332
schema := r.Reflect(&latest.Config{})
3433

34+
genSchema(schema, jsonschemaFile)
35+
genSchema(schema, openapiSchemaFile)
36+
}
37+
38+
func genSchema(schema *jsonschema.Schema, schemaFile string) {
39+
isOpenAPISpec := schemaFile == openapiSchemaFile
40+
prefix := ""
41+
if isOpenAPISpec {
42+
prefix = " "
43+
}
3544
schemaJSON, err := json.MarshalIndent(schema, prefix, " ")
3645
if err != nil {
3746
panic(err)
3847
}
3948

4049
schemaString := string(schemaJSON)
4150

42-
if mustGenerateOpenAPISpec {
51+
if isOpenAPISpec {
4352
schemaString = strings.ReplaceAll(schemaString, "#/$defs/", "#/definitions/Config/$defs/")
4453

45-
fmt.Printf(`{
54+
schemaString = fmt.Sprintf(`{
4655
"swagger": "2.0",
4756
"info": {
4857
"version": "%s",
@@ -54,7 +63,15 @@ func main() {
5463
}
5564
}
5665
`, latest.Version, schemaString)
57-
} else {
58-
fmt.Printf(`%s`, schemaString)
66+
}
67+
68+
err = os.MkdirAll(filepath.Dir(schemaFile), os.ModePerm)
69+
if err != nil {
70+
panic(err)
71+
}
72+
73+
err = ioutil.WriteFile(schemaFile, []byte(schemaString), os.ModePerm)
74+
if err != nil {
75+
panic(err)
5976
}
6077
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field" data-expandable="false" open>
3+
<summary>
4+
5+
##### `gitCredentials` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">boolean</span> <span className="config-field-default">false</span> <span className="config-field-enum"></span> {#dev-containers-proxyCommands-gitCredentials}
6+
7+
GitCredentials configures a git credentials helper inside the container that proxies local git credentials
8+
9+
</summary>
10+
11+
12+
13+
</details>

docs/pages/configuration/_partials/v2beta1/dev/containers/proxyCommands_reference.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

2+
import PartialGitCredentials from "./proxyCommands/gitCredentials.mdx"
23
import PartialCommand from "./proxyCommands/command.mdx"
34
import PartialLocalCommand from "./proxyCommands/localCommand.mdx"
45
import PartialSkipContainerEnv from "./proxyCommands/skipContainerEnv.mdx"
56
import PartialEnv from "./proxyCommands/env.mdx"
67

8+
<PartialGitCredentials />
9+
10+
711
<PartialCommand />
812

913

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
<details className="config-field" data-expandable="false" open>
3+
<summary>
4+
5+
#### `gitCredentials` <span className="config-field-required" data-required="false">required</span> <span className="config-field-type">boolean</span> <span className="config-field-default">false</span> <span className="config-field-enum"></span> {#dev-proxyCommands-gitCredentials}
6+
7+
GitCredentials configures a git credentials helper inside the container that proxies local git credentials
8+
9+
</summary>
10+
11+
12+
13+
</details>

docs/pages/configuration/_partials/v2beta1/dev/proxyCommands_reference.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

2+
import PartialGitCredentials from "./proxyCommands/gitCredentials.mdx"
23
import PartialCommand from "./proxyCommands/command.mdx"
34
import PartialLocalCommand from "./proxyCommands/localCommand.mdx"
45
import PartialSkipContainerEnv from "./proxyCommands/skipContainerEnv.mdx"
56
import PartialEnv from "./proxyCommands/env.mdx"
67

8+
<PartialGitCredentials />
9+
10+
711
<PartialCommand />
812

913

0 commit comments

Comments
 (0)