Opened 8 years ago

Last modified 3 years ago

#12930 assigned defect

ref.js resolveJSON schema look fails for object id's with [ or / characters

Reported by: tadams Owned by: dylan
Priority: high Milestone: 1.15
Component: Dojox Version: 1.6.1
Keywords: resolveJson schema Cc:
Blocked By: Blocking:

Description

In the ref.js, resolveJSON method, it makes use of a regular expression to find what I believe is the prefix for the absolute id, it then uses this to lookup the schema in this list of schemas. This code is shown below:

if(args.schemas && (!(it instanceof Array)) && // won't try on arrays to do prototypes, plus it messes with queries 
(val = id.match(/^(.+\/)[^\.\[]*$/))){ 
    schema = args.schemas[val[1]];
}

If the object id contains a ',?' or '/' character, the result of the regular expression val[1], does not represent the prefix of the absolute id and the regular expression fails. So an id of the form:

12345/myobj[blah=3]

Would fail to have its prefix detected, and its schema would not be picked up.

Would it be possible to enchance this so such object id, would succefully resolve. I probally am missing a larger designer here, but in this scenario, could the prefix parameter that is passed in not be used to do the schema lookup as opposed to cracking the id with this regular expression?

Change History (4)

comment:1 Changed 8 years ago by tadams

Sorry the formatting got met there the characters that in an object id that cause the regular expression to fail are left square brace, right square brace, and forward slash.

comment:2 Changed 8 years ago by Adam Peller

Owner: changed from Adam Peller to Kris Zyp

comment:3 Changed 3 years ago by dylan

Milestone: tbd1.12
Owner: changed from Kris Zyp to dylan
Status: newassigned

comment:4 Changed 3 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.