Skip to content

Commit c69761f

Browse files
authored
Merge pull request #228 from platformsh/cxtra-146-the-validate-command-does-not-work-with-composable-image
Add support for composable images when validating configs
2 parents 2ddf43f + 3191ebd commit c69761f

File tree

3 files changed

+137
-5
lines changed

3 files changed

+137
-5
lines changed

validator/schema/platformsh.application.json

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,11 +888,44 @@
888888
"type": "string"
889889
},
890890
"title": "Resolve additional IPs to domain names."
891+
},
892+
"stack": {
893+
"oneOf": [
894+
{
895+
"type": "string"
896+
},
897+
{
898+
"type": "object"
899+
},
900+
{
901+
"type": "array",
902+
"items": {
903+
"oneOf": [
904+
{
905+
"type": "string"
906+
},
907+
{
908+
"type": "object"
909+
}
910+
]
911+
}
912+
}
913+
]
891914
}
892915
},
893-
"required": [
894-
"name",
895-
"type"
916+
"oneOf": [
917+
{
918+
"required": [
919+
"name",
920+
"type"
921+
]
922+
},
923+
{
924+
"required": [
925+
"name",
926+
"stack"
927+
]
928+
}
896929
],
897930
"additionalProperties": false
898931
}

validator/schema/upsun.json

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,42 @@
875875
"type": "string"
876876
},
877877
"title": "Resolve additional IPs to domain names."
878+
},
879+
"stack": {
880+
"oneOf": [
881+
{
882+
"type": "string"
883+
},
884+
{
885+
"type": "object"
886+
},
887+
{
888+
"type": "array",
889+
"items": {
890+
"oneOf": [
891+
{
892+
"type": "string"
893+
},
894+
{
895+
"type": "object"
896+
}
897+
]
898+
}
899+
}
900+
]
878901
}
879902
},
880-
"required": [
881-
"type"
903+
"oneOf": [
904+
{
905+
"required": [
906+
"type"
907+
]
908+
},
909+
{
910+
"required": [
911+
"stack"
912+
]
913+
}
882914
],
883915
"additionalProperties": false
884916
}

validator/validator_test.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,73 @@ services:
127127
},
128128
wantErr: false,
129129
},
130+
{
131+
name: "stack",
132+
args: args{
133+
path: fstest.MapFS{
134+
".upsun/config.yaml": &fstest.MapFile{
135+
Data: []byte(`
136+
applications:
137+
app1:
138+
stack:
139+
140+
extensions:
141+
- apcu
142+
- sodium
143+
- xsl
144+
- pdo_sqlite
145+
- "nodejs@20"
146+
147+
`,
148+
),
149+
},
150+
".upsun/services.yaml": &fstest.MapFile{
151+
Data: []byte(`
152+
services:
153+
redis:
154+
type: redis:6.2
155+
size: AUTO
156+
`,
157+
),
158+
},
159+
},
160+
},
161+
wantErr: false,
162+
},
163+
{
164+
name: "stack-and-type",
165+
args: args{
166+
path: fstest.MapFS{
167+
".upsun/config.yaml": &fstest.MapFile{
168+
Data: []byte(`
169+
applications:
170+
app1:
171+
type: "python:3.11"
172+
stack:
173+
174+
extensions:
175+
- apcu
176+
- sodium
177+
- xsl
178+
- pdo_sqlite
179+
- "nodejs@20"
180+
181+
`,
182+
),
183+
},
184+
".upsun/services.yaml": &fstest.MapFile{
185+
Data: []byte(`
186+
services:
187+
redis:
188+
type: redis:6.2
189+
size: AUTO
190+
`,
191+
),
192+
},
193+
},
194+
},
195+
wantErr: true,
196+
},
130197
}
131198
for _, tt := range tests {
132199
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)