diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 6370eb0b6..778437960 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -1145,6 +1145,11 @@ describe "Config", -> expect(atom.config.get('foo.bar.str')).toBe 'global' expect(atom.config.get('foo.bar.str', scope: ['.source.js'])).toBe 'scoped' + expect(atom.config.set('foo.bar.noschema', 'nsGlobal')).toBe true + expect(atom.config.set('foo.bar.noschema', 'nsScoped', scopeSelector: '.source.js')).toBe true + expect(atom.config.get('foo.bar.noschema')).toBe 'nsGlobal' + expect(atom.config.get('foo.bar.noschema', scope: ['.source.js'])).toBe 'nsScoped' + expect(atom.config.set('foo.bar.int', 'nope')).toBe true expect(atom.config.set('foo.bar.int', 'notanint', scopeSelector: '.source.js')).toBe true expect(atom.config.set('foo.bar.int', 23, scopeSelector: '.source.coffee')).toBe true @@ -1156,6 +1161,8 @@ describe "Config", -> expect(atom.config.get('foo.bar.str')).toBe 'global' expect(atom.config.get('foo.bar.str', scope: ['.source.js'])).toBe 'scoped' + expect(atom.config.get('foo.bar.noschema')).toBe 'nsGlobal' + expect(atom.config.get('foo.bar.noschema', scope: ['.source.js'])).toBe 'nsScoped' expect(atom.config.get('foo.bar.int')).toBe 2 expect(atom.config.get('foo.bar.int', scope: ['.source.js'])).toBe 2 diff --git a/src/config.coffee b/src/config.coffee index 2666584c3..5ea29ef7b 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -1144,12 +1144,17 @@ Config.addSchemaEnforcers return value unless schema.properties? newValue = {} - for prop, childSchema of schema.properties - continue unless value.hasOwnProperty(prop) - try - newValue[prop] = @executeSchemaEnforcers("#{keyPath}.#{prop}", value[prop], childSchema) - catch error - console.warn "Error setting item in object: #{error.message}" + for prop, propValue of value + childSchema = schema.properties[prop] + if childSchema? + try + newValue[prop] = @executeSchemaEnforcers("#{keyPath}.#{prop}", propValue, childSchema) + catch error + console.warn "Error setting item in object: #{error.message}" + else + # Just pass through un-schema'd values + newValue[prop] = propValue + newValue 'array':