node-convict icon indicating copy to clipboard operation
node-convict copied to clipboard

Error thrown if Object type default value has a property with a period

Open shane-tomlinson opened this issue 7 years ago • 3 comments

This test case fails:

diff --git a/test/validation-tests.js b/test/validation-tests.js
index d3a3dfe..45f7dcd 100644
--- a/test/validation-tests.js
+++ b/test/validation-tests.js
@@ -239,4 +239,19 @@ describe('schema contains an object property with a custom format', function() {
       config.validate({ allowed: 'strict' });
     }).must.not.throw();
   });
+  it("must not throw if an object's default value property name contains a period", function() {
+    (function() {
+      const config = convict({
+        object: {
+          doc: 'default value contains property name that contains a period',
+          format: Object,
+          default: {
+            'foo.bar': ''
+          }
+        }
+      });
+
+      config.validate();
+    }).must.not.throw();
+  });
 });

blocks mozilla/fxa-content-server#6445

shane-tomlinson avatar Sep 06 '18 12:09 shane-tomlinson

@madarche i think this was fixed in https://github.com/mozilla/node-convict/pull/269 ?

vladikoff avatar Oct 18 '18 18:10 vladikoff

@vladikoff at the time of the last release, when I was filling the release notes, I had seen @shane-tomlinson's ticket and checked it against #269. I should have written about it in this ticket. Sorry. Unfortunately #269 doesn't solve Shane's provided test :disappointed:

With 55646f62003d61599a9f28e3fd8958a946d541fb I've just added Shane's test.

But I've skip-ped the test in the mocha tests so that the build is not shown as failed. But everyone can check for themselves that the provided test still fails: just remove the .skip string in the test description.

madarche avatar Oct 22 '18 08:10 madarche

Duplicate/Similar to : #250

A-312 avatar Dec 07 '19 11:12 A-312