Update compose 3.8 to disallow additional properties

This was added in other schemas in 1e99ed3ca3,
but not coppied to version 3.8

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-03-18 12:53:38 +01:00
parent cfd5b16ae0
commit 70846619a9
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 57 additions and 52 deletions

View File

@ -510,45 +510,45 @@ bnBpPlHfjORjkTRf1wyAwiYqMXd9/G6313QfoXs6/sbZ66r6e179PwAA//8ZL3SpvkUAAA==
"/data/config_schema_v3.8.json": { "/data/config_schema_v3.8.json": {
local: "data/config_schema_v3.8.json", local: "data/config_schema_v3.8.json",
size: 17835, size: 17912,
modtime: 1518458244, modtime: 1518458244,
compressed: ` compressed: `
H4sIAAAAAAAC/+xcS4/bOBK++1cYmrlNPwLsYLGb2x73tHvehiPQVNnmNEVyipTTTuD/vtCzJYoUKVtO H4sIAAAAAAAC/+xcS4/bOBK++1cImrlNPwLsYLGb2x73tHvehiPQVNnmNEVyipTTTuD/vtCzJYoUaVtO
dzAdIEi3VHzUg8WvHsr31Xqd/KrpAXKSfF4nB2PU58fHP7QU9/XTB4n7xwzJztx/+v2xfvZLcleOY1k5 dzAdIEi3VHzUk18VS/m+SpL0V033UJD0c5LujVGfHx//0FLcN08fJO4ecyRbc//p98fm2S/pXTWO5dUQ
hEqxY/u0fpMe//bwj4dyeE1iTgpKIrn9A6ipnyH8WTCEcvBTcgTUTIpkc7cq3ymUCtAw0Mnndbm59boj KsWW7bLmTXb428M/HqrhDYk5KqiI5OYPoKZ5hvBnyRCqwU/pAVAzKdL13ap6p1AqQMNAp5+TanNJ0pN0
aR/0ptUGmdgn1eNzNcN6nWjAI6O9Gbqt/vL4Ov9jR3Znz9rbbPVcEWMAxX/He6tef3ki99/+df+/T/f/ DwbTaoNM7NL68ameIUlSDXhgdDBDv9VfHl/nf+zJ7uxZB5utnytiDKD473Rv9esvT+T+27/u//fp/p8P
fEjvN7/9OnhdyhdhVy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XIZ12ZAukdjH9X1ENSC1VJtXyNyDhJqN1uP7OFCmWis3RLVmp
pXxzdEtW4gw13oPXLbbCk+C+sddd7sptezM9Wn3qUll3naw20Sr2Hozl9l9l1eyypSv9Rowh9BCVqZuZ M9V4D1G33AhPgfvGUXe5I7frzfRo9akvZd31slpHq9jrGMvtv66q2deWrvIbMYbQfVSl7syCyQ8ofE4K
MPkBic9Rot/p0hqqD482w6P97Pb//my1+YA0+JFiRRX+5vMKC4342uMd6P8nUevoEnaqtaH6UOvPolar /c6Q1lJ9RLQzItrPbv/vz1bbr1GDXzzWVOEPSK+w0IhvRN6B/n8StU4OYadaW6oPtf4sarXadQbqnV4b
Xaen3nHZaEri0T3Fq36VqNuGTeb4byB8EZZ3U74ip7VoI+xpzhe8tx5+m0CyU73/N4KACzRKunVqJV9W zUk8uqd4Nbwl6rdhkzn+TwlfhuXdlO+S01q0FfY85wueWw+/zSDZud7/G0HABRol3Tq1ii+rvi3S/iTe
XVuk/RW735e040fftJd8itOorPl92BpTf4++GcjHIqm/y+kBhU1UYO760t1uzGm/OPf0Cg6j11X597z6 H0u68ZMP5Cs+xXFyrfl93BrTfNy+HsnHImm+yxkAhXVUYu76bN5uzOk+X/f0Co6z11X197T6fwAAAP//
fwAAAP//uQ4+qatFAAA= yYJltPhFAAA=
`, `,
}, },

View File

@ -122,10 +122,14 @@
} }
}, },
"container_name": {"type": "string"}, "container_name": {"type": "string"},
"credential_spec": {"type": "object", "properties": { "credential_spec": {
"type": "object",
"properties": {
"file": {"type": "string"}, "file": {"type": "string"},
"registry": {"type": "string"} "registry": {"type": "string"}
}}, },
"additionalProperties": false
},
"depends_on": {"$ref": "#/definitions/list_of_strings"}, "depends_on": {"$ref": "#/definitions/list_of_strings"},
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
"dns": {"$ref": "#/definitions/string_or_list"}, "dns": {"$ref": "#/definitions/string_or_list"},

View File

@ -80,17 +80,6 @@ func TestValidateAllowsXFields(t *testing.T) {
} }
func TestValidateCredentialSpecs(t *testing.T) { func TestValidateCredentialSpecs(t *testing.T) {
config := dict{
"version": "99.99",
"services": dict{
"foo": dict{
"image": "busybox",
"credential_spec": dict{
"config": "foobar",
},
},
},
}
tests := []struct { tests := []struct {
version string version string
expectedErr string expectedErr string
@ -103,11 +92,23 @@ func TestValidateCredentialSpecs(t *testing.T) {
{version: "3.5", expectedErr: "config"}, {version: "3.5", expectedErr: "config"},
{version: "3.6", expectedErr: "config"}, {version: "3.6", expectedErr: "config"},
{version: "3.7", expectedErr: "config"}, {version: "3.7", expectedErr: "config"},
{version: "3.8", expectedErr: "something"},
} }
for _, tc := range tests { for _, tc := range tests {
tc := tc tc := tc
t.Run(tc.version, func(t *testing.T) { t.Run(tc.version, func(t *testing.T) {
config := dict{
"version": "99.99",
"services": dict{
"foo": dict{
"image": "busybox",
"credential_spec": dict{
tc.expectedErr: "foobar",
},
},
},
}
err := Validate(config, tc.version) err := Validate(config, tc.version)
if tc.expectedErr != "" { if tc.expectedErr != "" {
assert.ErrorContains(t, err, fmt.Sprintf("Additional property %s is not allowed", tc.expectedErr)) assert.ErrorContains(t, err, fmt.Sprintf("Additional property %s is not allowed", tc.expectedErr))