From 7326608369d52656eae56202d3cc005300a17771 Mon Sep 17 00:00:00 2001 From: Mazz Mosley Date: Thu, 3 Sep 2015 11:44:08 +0100 Subject: [PATCH] expose array can contain either strings or numbers Signed-off-by: Mazz Mosley --- compose/config/fields_schema.json | 6 +++++- tests/unit/config_test.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/compose/config/fields_schema.json b/compose/config/fields_schema.json index 2a122b7a3..f03ef7110 100644 --- a/compose/config/fields_schema.json +++ b/compose/config/fields_schema.json @@ -42,7 +42,11 @@ ] }, - "expose": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, + "expose": { + "type": "array", + "items": {"type": ["string", "number"]}, + "uniqueItems": true + }, "extends": { "type": "object", diff --git a/tests/unit/config_test.py b/tests/unit/config_test.py index 21f1261ec..3f602fb59 100644 --- a/tests/unit/config_test.py +++ b/tests/unit/config_test.py @@ -239,6 +239,21 @@ class ConfigTest(unittest.TestCase): ) ) + def test_valid_config_which_allows_two_type_definitions(self): + expose_values = [["8000"], [8000]] + for expose in expose_values: + service = config.load( + config.ConfigDetails( + {'web': { + 'image': 'busybox', + 'expose': expose + }}, + 'working_dir', + 'filename.yml' + ) + ) + self.assertEqual(service[0]['expose'], expose) + class InterpolationTest(unittest.TestCase): @mock.patch.dict(os.environ)