Comments (5)
run with blaze -v and see if that helps. Let me know the output
Tom
On Wed, Aug 27, 2014 at 12:39 PM, Henrik Strøm [email protected]
wrote:
Often, an error message doesn't contain a line number or any other clue as
to where to find the error.Example:
$ blaze rules.yaml
transpiling rules.yaml
loading type any definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/any.yaml
loading type boolean definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/boolean.yaml
loading type number definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/number.yaml
loading type object definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/object.yaml
loading type string definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/string.yaml
compile string
compile string
compile string
compile string
compile object
compile object
compile object
compile object
Cannot call method 'has' of undefinedI would really be nice if the error message always contained a line number.
—
Reply to this email directly or view it on GitHub
#12.
from blaze_compiler.
Oh and if its not confidential can you send me your rules.yaml as well.
Basically there is line and column number error reporting, but some of the
null pointer errors are not covered so you have hit one and I need to fix
that particular case.
Tom
On Wed, Aug 27, 2014 at 1:01 PM, Tom Larkworthy [email protected] wrote:
run with blaze -v and see if that helps. Let me know the output
Tom
On Wed, Aug 27, 2014 at 12:39 PM, Henrik Strøm [email protected]
wrote:Often, an error message doesn't contain a line number or any other clue
as to where to find the error.Example:
$ blaze rules.yaml
transpiling rules.yaml
loading type any definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/any.yaml
loading type boolean definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/boolean.yaml
loading type number definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/number.yaml
loading type object definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/object.yaml
loading type string definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/string.yaml
compile string
compile string
compile string
compile string
compile object
compile object
compile object
compile object
Cannot call method 'has' of undefinedI would really be nice if the error message always contained a line
number.—
Reply to this email directly or view it on GitHub
#12.
from blaze_compiler.
rules.yam
file:
functions:
- isLoggedIn(): auth.username !== null
- createOnly(): next.exists() && !prev.exists()
- deleteOnly(): prev.exists() && !next.exists()
- createOrDelete(): createOnly() || deleteOnly()
- userOwner(): $userid === auth.username
schema:
definitions:
booking:
type: object
properties:
apikey:
type: string
date:
type: string
phone:
type: string
time:
type: string
data:
type: object
required: [apikey, phone, date, time, data]
additionalProperties: false
user:
type: object
properties:
apikey:
type: string
email:
type: string
name:
type: string
password:
type: string
phone:
type: string
username:
type: string
required: [apikey, email, name, password, phone, username]
additionalProperties: false
type: object
properties:
queue:
type: object
$bookingid:
type: object
$booking: {$ref: "#/definitions/booking"}
users:
type: object
$userid:
type: object
$user: {$ref: "#definitions/user"}
access:
# everybody can submit bookings to the queue
- location: queue
write: createOnly()
read: false
# users can update their own bookings
- location: users/$userid/bookings
write: userOwner()
read: userOwner()
Output:
args { _: [ 'rules.yaml' ],
v: true,
java: false,
'$0': '/usr/local/bin/blaze' }
transpiling rules.yaml
loading type any definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/any.yaml
loading type boolean definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/boolean.yaml
loading type number definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/number.yaml
loading type object definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/object.yaml
loading type string definition from /usr/local/lib/node_modules/blaze_compiler/src/../schema/metaschema/string.yaml
annotate_schema { type: 'object',
'$bookingid':
{ type: 'object',
'$booking': { '$ref': '#/definitions/booking' } } }
annotate_schema { type: 'object',
'$booking': { '$ref': '#/definitions/booking' } }
fetchRef#/definitions/booking
annotate_schema { type: 'string' }
compile string
addConstraint !next.exists() || next.isString()
getField on enum result: undefined { type: 'string' }
annotate_schema { type: 'string' }
compile string
addConstraint !next.exists() || next.isString()
getField on enum result: undefined { type: 'string' }
annotate_schema { type: 'string' }
compile string
addConstraint !next.exists() || next.isString()
getField on enum result: undefined { type: 'string' }
annotate_schema { type: 'string' }
compile string
addConstraint !next.exists() || next.isString()
getField on enum result: undefined { type: 'string' }
annotate_schema { type: 'object' }
compile object
addConstraint !next.exists() || !(next.isString()||next.isNumber()||next.isBoolean())
getField on required result: undefined { type: 'object' }
addConstraint next == null || (true)
annotate_schema { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
compile object
addConstraint !next.exists() || !(next.isString()||next.isNumber()||next.isBoolean())
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
getField on required result: [ 'apikey', 'phone', 'date', 'time', 'data' ] { type: 'object',
properties:
{ apikey:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
date:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
phone:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
time:
{ type: 'string',
constraint: '(true) && (!next.exists() || next.isString())' },
data:
{ type: 'object',
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } },
required: [ 'apikey', 'phone', 'date', 'time', 'data' ],
additionalProperties: false }
addConstraint next == null || (true&&next['apikey'].exists()&&next['phone'].exists()&&next['date'].exists()&&next['time'].exists()&&next['data'].exists())
compile object
addConstraint !next.exists() || !(next.isString()||next.isNumber()||next.isBoolean())
getField on required result: undefined { type: 'object',
'$booking': { '$ref': '#/definitions/booking' },
patternProperties: { '.*': { '$ref': '#/definitions/booking' } } }
addConstraint next == null || (true)
compile object
addConstraint !next.exists() || !(next.isString()||next.isNumber()||next.isBoolean())
getField on required result: undefined { type: 'object',
'$bookingid':
{ type: 'object',
'$booking': { '$ref': '#/definitions/booking' },
patternProperties: { '.*': [Object] },
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' },
patternProperties:
{ '.*':
{ type: 'object',
'$booking': [Object],
patternProperties: [Object],
constraint: '((true) && (!next.exists() || !(next.isString()||next.isNumber()||next.isBoolean()))) && (next == null || (true))' } } }
addConstraint next == null || (true)
annotate_schema { type: 'object',
'$userid': { type: 'object', '$user': { '$ref': '#definitions/user' } } }
annotate_schema { type: 'object', '$user': { '$ref': '#definitions/user' } }
fetchRef#definitions/user
From the verbose output I can see where the problem is, but I can't see from the example how to define multiple models - that seems to be the problem.
from blaze_compiler.
Thanks, I am looking into it now ...
On Thu, Aug 28, 2014 at 6:09 PM, Henrik Strøm [email protected]
wrote:
—
Reply to this email directly or view it on GitHub
#12 (comment).
from blaze_compiler.
Hi Henrik,
you did indeed find a hole in the normal error reporting, thanks for finding it! There was another problem after as well
- the $ref URL for user was missing a / after the #, and was a case that avoided the normal error reporting (fixed)
- the indentation for "required" in the user definition was 1 level too deep, so required was interpreted as properties schema node, not a keyword of the user.
I also think you probably don't want two levels of wildchilds, you probably just want a single list of users and a single list of bookings so:-
properties:
queue:
type: object
$bookingid: {$ref: "#/definitions/booking"}
users:
type: object
$userid: {$ref: "#definitions/user"}
instead of :
properties:
queue:
type: object
$bookingid:
type: object
$booking: {$ref: "#/definitions/booking"}
users:
type: object
$userid:
type: object
$user: {$ref: "#definitions/user"}
the latter is creating a list of $users inside a list of $userid
from blaze_compiler.
Related Issues (20)
- Better error message for missing type when using required HOT 1
- Add duplicate examples warning HOT 1
- Unable to compile with io.js HOT 7
- cannot be cast from JString to JObject HOT 4
- regex constraints not working with nonexamples HOT 2
- Are ACL entries modified by their position HOT 1
- Unexpected implementation level of access rules. HOT 3
- Function output replaces auth.uid if a $uid wildchild is in location HOT 4
- Boolean must be compared to true or false HOT 3
- Error: Cannot find module '../src/cli' HOT 8
- Doesn't work on Windows HOT 1
- Blaze Ember Cli Addon
- After updating to version 0.0.35, blaze compile never finishes HOT 4
- Support for Firebase rule string methods (toUpperCase, toLowerCase, etc) HOT 3
- Access control location with two $wildchilds returns error HOT 4
- Regular Expression Issue for Email validation \ is getting repeated twice HOT 2
- npm install fails HOT 1
- Functions calls doesn't evaluate the params before passing it HOT 5
- Nested functions to not properly wrap conditions HOT 1
- State of blaze compiler going forward? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blaze_compiler.