Skip to content
akidee edited this page Feb 22, 2011 · 3 revisions

BTW, can you provide a separate "bundled" version of schema.js -- that is one file -- so we can reuse the code easily at client-side, in browsers.

Currently, this is not a solution I would recommend. Two causes:

  1. Not all ECMA features, that schema needs, are supported by all browsers. I will use schema.js on the server-side only. This is a constraint, of course. I am already planning for the next version, and I am always trying to write my libraries as JavaScript implementation tolerant as possible.
  2. Browsers should support require(). In the world of RIA, that get more sophisticated, it is recommended to use a CommonJS implementation that works on the client-side. A promising project is http://requirejs.org/ Feel free to build a one file solution for yourself.

--

I'm inclined to consider client-side validation some kind of redundancy, since it's way easily bypassed.

Of course, you must always validate on the server-side. Client-side validation is redundant.

--

Suppose I want to validate a partially defined instance. That is the case for bulk update, say, when I want to validate only properties that exist in the passed instance. How can I do so? In effect, silence errors due to a property being missing.

In this case, you need a new schema. Currently, you should not use "extends" to do so. I have desribed the problem here: http://groups.google.com/group/json-schema/browse_thread/thread/275cdf7df754448b

Clone this wiki locally