Skip to content

Commit 67f86bc

Browse files
committed
docs: fix schema
1 parent f5cd2a1 commit 67f86bc

3 files changed

Lines changed: 68 additions & 106 deletions

File tree

devspace-schema.json

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,11 @@
20022002
"pipelines": {
20032003
"anyOf": [
20042004
{
2005+
"patternProperties": {
2006+
".*": {
2007+
"type": "string"
2008+
}
2009+
},
20052010
"type": "object"
20062011
},
20072012
{
@@ -2017,36 +2022,20 @@
20172022
"description": "Pipelines are the work blocks that DevSpace should execute when devspace dev, devspace build, devspace deploy or devspace purge\nis called. Pipelines are defined through a special POSIX script that allows you to use special commands\nsuch as create_deployments, start_dev, build_images etc. to signal DevSpace you want to execute\na specific functionality. The pipelines dev, build, deploy and purge are special and will override\nthe default functionality of the respective command if defined. All other pipelines can be either run\nvia the devspace run-pipeline command or used within another pipeline through run_pipelines."
20182023
},
20192024
"images": {
2020-
"anyOf": [
2021-
{
2022-
"type": "object"
2023-
},
2024-
{
2025-
"patternProperties": {
2026-
".*": {
2027-
"$ref": "#/$defs/Image"
2028-
}
2029-
},
2030-
"type": "object"
2025+
"patternProperties": {
2026+
".*": {
2027+
"$ref": "#/$defs/Image"
20312028
}
2032-
],
2029+
},
20332030
"type": "object",
20342031
"description": "Images holds configuration of how DevSpace should build images. By default, DevSpace will build all defined images.\nIf you are using a custom pipeline, you can dynamically define which image is built at which time during the\nexecution."
20352032
},
20362033
"deployments": {
2037-
"anyOf": [
2038-
{
2039-
"type": "object"
2040-
},
2041-
{
2042-
"patternProperties": {
2043-
".*": {
2044-
"$ref": "#/$defs/DeploymentConfig"
2045-
}
2046-
},
2047-
"type": "object"
2034+
"patternProperties": {
2035+
".*": {
2036+
"$ref": "#/$defs/DeploymentConfig"
20482037
}
2049-
],
2038+
},
20502039
"type": "object",
20512040
"description": "Deployments holds configuration of how DevSpace should deploy resources to Kubernetes. By default, DevSpace will deploy all defined deployments.\nIf you are using a custom pipeline, you can dynamically define which deployment is deployed at which time during the\nexecution."
20522041
},
@@ -2062,6 +2051,11 @@
20622051
"vars": {
20632052
"anyOf": [
20642053
{
2054+
"patternProperties": {
2055+
".*": {
2056+
"type": "string"
2057+
}
2058+
},
20652059
"type": "object"
20662060
},
20672061
{
@@ -2079,6 +2073,11 @@
20792073
"commands": {
20802074
"anyOf": [
20812075
{
2076+
"patternProperties": {
2077+
".*": {
2078+
"type": "string"
2079+
}
2080+
},
20822081
"type": "object"
20832082
},
20842083
{
@@ -2094,36 +2093,20 @@
20942093
"description": "Commands are custom commands that can be executed via 'devspace run COMMAND'. These commands are run within a pseudo bash\nthat also allows executing special commands such as run_watch or is_equal."
20952094
},
20962095
"dependencies": {
2097-
"anyOf": [
2098-
{
2099-
"type": "object"
2100-
},
2101-
{
2102-
"patternProperties": {
2103-
".*": {
2104-
"$ref": "#/$defs/DependencyConfig"
2105-
}
2106-
},
2107-
"type": "object"
2096+
"patternProperties": {
2097+
".*": {
2098+
"$ref": "#/$defs/DependencyConfig"
21082099
}
2109-
],
2100+
},
21102101
"type": "object",
21112102
"description": "Dependencies are sub devspace projects that lie in a local folder or remote git repository that can be executed\nfrom within the pipeline. In contrast to imports, these projects pose as separate fully functional DevSpace projects\nthat typically lie including source code in a different folder and can be used to compose a full microservice\napplication that will be deployed by DevSpace. Each dependency name can only be used once and if you want to use\nthe same project multiple times, make sure to use a different name for each of those instances."
21122103
},
21132104
"pullSecrets": {
2114-
"anyOf": [
2115-
{
2116-
"type": "object"
2117-
},
2118-
{
2119-
"patternProperties": {
2120-
".*": {
2121-
"$ref": "#/$defs/PullSecretConfig"
2122-
}
2123-
},
2124-
"type": "object"
2105+
"patternProperties": {
2106+
".*": {
2107+
"$ref": "#/$defs/PullSecretConfig"
21252108
}
2126-
],
2109+
},
21272110
"type": "object",
21282111
"description": "PullSecrets are image pull secrets that will be created by devspace in the target namespace\nduring devspace dev or devspace deploy. DevSpace will merge all defined pull secrets into a single\none or the one specified."
21292112
},

docs/hack/config/schemas/main.go

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
const jsonschemaFile = "devspace-schema.json"
16-
const openapiSchemaFile = "devspace-openapi.json"
16+
const openapiSchemaFile = "docs/schemas/config-openapi.json"
1717

1818
// Run executes the command logic
1919
func main() {
@@ -48,48 +48,19 @@ func genSchema(schema *jsonschema.Schema, schemaFile string) {
4848
vars.(*jsonschema.Schema).AnyOf = modifyAnyOf(vars)
4949
vars.(*jsonschema.Schema).PatternProperties = nil
5050
}
51-
5251
// pipelines
5352
pipelines, ok := schema.Properties.Get("pipelines")
5453
if ok {
5554
pipelines.(*jsonschema.Schema).AnyOf = modifyAnyOf(pipelines)
5655
pipelines.(*jsonschema.Schema).PatternProperties = nil
5756
}
58-
5957
// commands
6058
commands, ok := schema.Properties.Get("commands")
6159
if ok {
6260
commands.(*jsonschema.Schema).AnyOf = modifyAnyOf(commands)
6361
commands.(*jsonschema.Schema).PatternProperties = nil
6462
}
6563

66-
// images
67-
images, ok := schema.Properties.Get("images")
68-
if ok {
69-
images.(*jsonschema.Schema).AnyOf = modifyAnyOf(images)
70-
images.(*jsonschema.Schema).PatternProperties = nil
71-
}
72-
73-
//deployments
74-
deployments, ok := schema.Properties.Get("deployments")
75-
if ok {
76-
deployments.(*jsonschema.Schema).AnyOf = modifyAnyOf(deployments)
77-
deployments.(*jsonschema.Schema).PatternProperties = nil
78-
}
79-
80-
//dependencies
81-
dependencies, ok := schema.Properties.Get("dependencies")
82-
if ok {
83-
dependencies.(*jsonschema.Schema).AnyOf = modifyAnyOf(dependencies)
84-
dependencies.(*jsonschema.Schema).PatternProperties = nil
85-
}
86-
//pullSecrets
87-
pullSecrets, ok := schema.Properties.Get("pullSecrets")
88-
if ok {
89-
pullSecrets.(*jsonschema.Schema).AnyOf = modifyAnyOf(pullSecrets)
90-
pullSecrets.(*jsonschema.Schema).PatternProperties = nil
91-
}
92-
9364
schemaJSON, err := json.MarshalIndent(schema, prefix, " ")
9465
if err != nil {
9566
panic(err)
@@ -129,6 +100,11 @@ func modifyAnyOf(field interface{}) []*jsonschema.Schema {
129100
return []*jsonschema.Schema{
130101
{
131102
Type: "object",
103+
PatternProperties: map[string]*jsonschema.Schema{
104+
".*": {
105+
Type: "string",
106+
},
107+
},
132108
},
133109
{
134110
Type: "object",
Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,11 @@
20102010
"pipelines": {
20112011
"anyOf": [
20122012
{
2013+
"patternProperties": {
2014+
".*": {
2015+
"type": "string"
2016+
}
2017+
},
20132018
"type": "object"
20142019
},
20152020
{
@@ -2020,26 +2025,20 @@
20202025
"description": "Pipelines are the work blocks that DevSpace should execute when devspace dev, devspace build, devspace deploy or devspace purge\nis called. Pipelines are defined through a special POSIX script that allows you to use special commands\nsuch as create_deployments, start_dev, build_images etc. to signal DevSpace you want to execute\na specific functionality. The pipelines dev, build, deploy and purge are special and will override\nthe default functionality of the respective command if defined. All other pipelines can be either run\nvia the devspace run-pipeline command or used within another pipeline through run_pipelines."
20212026
},
20222027
"images": {
2023-
"anyOf": [
2024-
{
2025-
"type": "object"
2026-
},
2027-
{
2028-
"type": "object"
2028+
"patternProperties": {
2029+
".*": {
2030+
"$ref": "#/definitions/Config/$defs/Image"
20292031
}
2030-
],
2032+
},
20312033
"type": "object",
20322034
"description": "Images holds configuration of how DevSpace should build images. By default, DevSpace will build all defined images.\nIf you are using a custom pipeline, you can dynamically define which image is built at which time during the\nexecution."
20332035
},
20342036
"deployments": {
2035-
"anyOf": [
2036-
{
2037-
"type": "object"
2038-
},
2039-
{
2040-
"type": "object"
2037+
"patternProperties": {
2038+
".*": {
2039+
"$ref": "#/definitions/Config/$defs/DeploymentConfig"
20412040
}
2042-
],
2041+
},
20432042
"type": "object",
20442043
"description": "Deployments holds configuration of how DevSpace should deploy resources to Kubernetes. By default, DevSpace will deploy all defined deployments.\nIf you are using a custom pipeline, you can dynamically define which deployment is deployed at which time during the\nexecution."
20452044
},
@@ -2055,6 +2054,11 @@
20552054
"vars": {
20562055
"anyOf": [
20572056
{
2057+
"patternProperties": {
2058+
".*": {
2059+
"type": "string"
2060+
}
2061+
},
20582062
"type": "object"
20592063
},
20602064
{
@@ -2067,6 +2071,11 @@
20672071
"commands": {
20682072
"anyOf": [
20692073
{
2074+
"patternProperties": {
2075+
".*": {
2076+
"type": "string"
2077+
}
2078+
},
20702079
"type": "object"
20712080
},
20722081
{
@@ -2077,26 +2086,20 @@
20772086
"description": "Commands are custom commands that can be executed via 'devspace run COMMAND'. These commands are run within a pseudo bash\nthat also allows executing special commands such as run_watch or is_equal."
20782087
},
20792088
"dependencies": {
2080-
"anyOf": [
2081-
{
2082-
"type": "object"
2083-
},
2084-
{
2085-
"type": "object"
2089+
"patternProperties": {
2090+
".*": {
2091+
"$ref": "#/definitions/Config/$defs/DependencyConfig"
20862092
}
2087-
],
2093+
},
20882094
"type": "object",
20892095
"description": "Dependencies are sub devspace projects that lie in a local folder or remote git repository that can be executed\nfrom within the pipeline. In contrast to imports, these projects pose as separate fully functional DevSpace projects\nthat typically lie including source code in a different folder and can be used to compose a full microservice\napplication that will be deployed by DevSpace. Each dependency name can only be used once and if you want to use\nthe same project multiple times, make sure to use a different name for each of those instances."
20902096
},
20912097
"pullSecrets": {
2092-
"anyOf": [
2093-
{
2094-
"type": "object"
2095-
},
2096-
{
2097-
"type": "object"
2098+
"patternProperties": {
2099+
".*": {
2100+
"$ref": "#/definitions/Config/$defs/PullSecretConfig"
20982101
}
2099-
],
2102+
},
21002103
"type": "object",
21012104
"description": "PullSecrets are image pull secrets that will be created by devspace in the target namespace\nduring devspace dev or devspace deploy. DevSpace will merge all defined pull secrets into a single\none or the one specified."
21022105
},

0 commit comments

Comments
 (0)