Home | Projects | Tutorials | Articles | live chat | Submit Project | Big Vote
 
Ajax Projects
.NET Frameworks
Java Frameworks
PHP Frameworks
Ruby Frameworks
Other Frameworks
Cool AJAX sites
Ajax Resources
Ajax Tools
JavaScript frameworks

 Home /  Tutorials / How JSON Schema is turning out for the Chrome extension APIs

How JSON Schema is turning out for the Chrome extension APIs





When Aaron talked about the Chrome extension API he mentioned how he would see if JSON Schema could help them have a JSON heavy API and allow them to easily validate.

Read The Full Tutorial.
































When Aaron talked about the Chrome extension API he mentioned how he would see if JSON Schema could help them have a JSON heavy API and allow them to easily validate.

He has quickly reported back and is happy with the results.

Something like this:


PLAIN TEXT
JAVASCRIPT:

   1.
      
   2.
      chromium.tabs.createTab = function(tab, callback) {
   3.
        validate(arguments, arguments.callee.params);
   4.
        sendRequest(CreateTab, tab, callback);
   5.
      };
   6.
      
   7.
      chromium.tabs.createTab.params = [
   8.
        {
   9.
          type: "object",
  10.
          properties: {
  11.
            windowId: chromium.types.optPInt,
  12.
            url: chromium.types.optStr,
  13.
            selected: chromium.types.optBool
  14.
          },
  15.
          additionalProperties: false
  16.
        },
  17.
        chromium.types.optFun
  18.
      ];
  19.
      

will give you errors such as:

    Invalid value for parameter 0. Property windowId: expected integer, got string.

It will be interesting to see how the APIs look when you go for this style throughout. Looking forward to see more.

source: ajaxian

AddThis Social Bookmark Button
Top Projects
MSN Web Messenger
MessengerFX
ebuddy
e-messenger
ILoveIM
You Tube
AJAX file upload
KoolIM.com
Meebo
Ajax.NET Professional
Tutorials
PHP-AJAX Chat/Shoutbox Example
Server Side JavaScript Layout Engine
Replace jQuery Validation Message Formatting with ASP.NET AJAX String.format()
A Simple Cross-Domain Ajax
Another Way to Test Ajax Methods
Adding ASP.NET Ajax Control Toolkit to Visual Studio 2010
HTTP Form POST Request using AJAX and Servlet
jTemplates with jQuery, AJAX and Json
Implementing Ajax with jQuery
AJAX.NET Cascading Dropdownlist