Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use the name "properties" within a schema #318

Closed
arhughes opened this issue Sep 3, 2019 · 1 comment · Fixed by A-312/node-blueconfig#1
Closed

Unable to use the name "properties" within a schema #318

arhughes opened this issue Sep 3, 2019 · 1 comment · Fixed by A-312/node-blueconfig#1

Comments

@arhughes
Copy link

arhughes commented Sep 3, 2019

It is not possible to have a schema with an element named "properties".

const convict = require('convict');

const config = convict({
  thing: {
    properties: {
      one: {
        default: 1,
        format: 'Number',
      },
      two: {
        default: 2,
        format: 'Number',
      },
    },
  },
});

config.validate();

Produces the output:

Warning: configuration param 'thing.properties.one' not declared in the schema
configuration param 'thing.properties.two' not declared in the schema
[snip]/convict-test/node_modules/convict/lib/convict.js:679
          throw new Error(output);
          ^

Error: configuration param 'thing.one' missing from config, did you override its parent?
configuration param 'thing.two' missing from config, did you override its parent?
    at Object.validate ([snip]/convict-test/node_modules/convict/lib/convict.js:679:17)
    at Object.<anonymous> ([snip]/convict-test/index.js:18:8)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

Renaming properties to any other string makes the configuration validate without error..

@A-312
Copy link
Contributor

A-312 commented Nov 21, 2019

I will make a PR to fix this issue, i will replace properties keyname by _properties or _cvctProperties. Or : _cvctPr0p3rti3s, i think this one will never be use by convict user.

And add an error : "Error: You use convict reserved name".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants