Skip to content

Commit 374bee2

Browse files
committed
schema: allow the "type" property for composable images
1 parent 91d87ed commit 374bee2

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

validator/schema/upsun.json

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"firewall": {"$ref": "#/definitions/firewall"},
4343
"type": {
4444
"type": "string",
45-
"title": "The base runtime (language) and version to use for this application",
46-
"description": "The base image to use with a specific app language. \nFormat: runtime:version. \nMore information: \nhttps://docs.upsun.com/create-apps/app-reference/single-runtime-image.html#types"
45+
"title": "The base runtime and version to use for this application",
46+
"description": "The base image to use. \nFormat: runtime:version. \nMore information: \nhttps://docs.upsun.com/create-apps/app-reference/single-runtime-image.html#types"
4747
},
4848
"runtime": {
4949
"type": "object",
@@ -687,41 +687,30 @@
687687
"description": "More information: \nhttps://docs.upsun.com/create-apps/app-reference/single-runtime-image.html#additional-hosts"
688688
},
689689
"stack": {
690-
"oneOf": [
691-
{
692-
"type": "string"
693-
},
694-
{
695-
"type": "object"
696-
},
697-
{
698-
"type": "array",
699-
"items": {
700-
"oneOf": [
701-
{
702-
"type": "string"
703-
},
704-
{
705-
"type": "object"
706-
}
707-
]
690+
"type": "array",
691+
"items": {
692+
"oneOf": [
693+
{
694+
"type": "string"
695+
},
696+
{
697+
"type": "object"
708698
}
709-
}
710-
],
699+
],
700+
"description": "A package definition, for example 'package@version' (for services) or just 'package' (for tools)."
701+
},
711702
"title": "Composable Image definition",
712-
"description": "A list of packages from the Upsun collection of supported runtimes and/or from NixPkgs. \nMore information: \nhttps://docs.upsun.com/create-apps/app-reference/composable-image.html"
713-
}
703+
"description": "A list of Nix packages from NixPkgs. \nMore information: \nhttps://docs.upsun.com/create-apps/app-reference/composable-image.html" }
714704
},
715-
"oneOf": [
705+
"anyOf": [
716706
{
717-
"required": [
718-
"type"
719-
]
707+
"required": ["type"]
720708
},
721709
{
722-
"required": [
723-
"stack"
724-
]
710+
"required": ["stack"]
711+
},
712+
{
713+
"required": ["type", "stack"]
725714
}
726715
],
727716
"additionalProperties": false

validator/validator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ services:
171171
Data: []byte(`
172172
applications:
173173
app1:
174-
type: "python:3.11"
174+
type: "composable:25.05"
175175
stack:
176176
177177
extensions:
@@ -195,7 +195,7 @@ services:
195195
},
196196
},
197197
},
198-
wantErr: true,
198+
wantErr: false,
199199
},
200200
{
201201
name: "true-boolean",

0 commit comments

Comments
 (0)