From f651f596ccdac372714caef7d6a26d0d14f5306c Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Mon, 6 Apr 2015 14:27:20 -0400 Subject: Expose resource raw schema --- app/node_modules/okresource/index.js | 5 +++++ app/node_modules/okschema/index.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/node_modules/okresource/index.js b/app/node_modules/okresource/index.js index 055a24a..2eba03a 100644 --- a/app/node_modules/okresource/index.js +++ b/app/node_modules/okresource/index.js @@ -15,6 +15,7 @@ function OKResource(options) { throw new Error('No schema provided to OKResource'); if (!options.db) throw new Error('No DB provided to OKResource'); + var schema = options.schema; var type = options.type; this._db = options.db; // Define properties which are part of the API @@ -22,6 +23,10 @@ function OKResource(options) { value: schema, writable: false }); + Object.defineProperty(this, 'spec', { + value: schema.spec, + writable: false + }); Object.defineProperty(this, 'type', { value: type, writable: false diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js index c601a07..1ffe2d6 100644 --- a/app/node_modules/okschema/index.js +++ b/app/node_modules/okschema/index.js @@ -9,7 +9,10 @@ function OKSchema(spec) { if (!(this instanceof OKSchema)) return new OKSchema(spec); if (!spec) throw new Error('No spec provided to OKSchema'); - this._spec = spec; + Object.defineProperty(this, 'spec', { + value: spec, + writable: false + }); } OKSchema.prototype.assertValid = function(data) { -- cgit v1.2.3-70-g09d2