title: JSON schema with nested objects
body: <p>I'm trying to validate some JSON objects using the <a href="http://dojotoolkit.org/reference-guide/1.9/dojox/json/schema.html" rel="noreferrer">dojox JSON schema validator</a> but I am new to this sort of thing and I can't get my schema right. I'm mostly trying to make sure that there aren't any missing fields in my objects.</p>
  
  <p>Basically, I have an object that has two fields called type and description. The object can also have a properties field that contains any number of additional object fields. I put a little grammar representation below if that helps</p>
  
  <p>Args : TYPE DESCRIPTION [Properties]</p>
  
  <p>Properties : Args+</p>
  
  <p>An example of my object looks like so:</p>
  
  <pre><code>{
          "type": "object",
          "description": "The point of interest location description.",
          "properties": {
              "pageIndex": {
                  "type": "number",
                  "description": "The page index to view"
              },
              "points": {
                  "description": "Used if viewState.zoomWidth is true; specifies 4 corners of the rectangle to make visible.",
                  "type": "array of point objects {x: y:}"
              },
              "viewState": {
                  "type": "object",
                  "description": "The view state information",
                  "properties": {
                      "hasViewState": {
                          "type": "boolean",
                          "description": "Whether there is view state information to use"
                      },
                      "rotate": {
                          "type": "number",
                          "description": "Degrees of rotation"
                      },
                      "extents": {
                          "type": "boolean",
                          "description": "Whether the view should scale to fit extents or not"
                      },
                      "zoomWidth": {
                          "type": "boolean",
                          "description": "Whether the view should scale to fit width or not"
                      },
                      "scaleFactor": {
                          "type": "number",
                          "description": "The scale factor for the view state"
                      },
                      "deviceRect": {
                          "type": "object",
                          "description": "The device rectangle geometry",
                          "properties": {
                              "left": {
                                  "type": "number",
                                  "description": "The left edge of the device rectangle"
                              },
                              "right": {
                                  "type": "number",
                                  "description": "The right edge of the device rectangle"
                              },
                              "top": {
                                  "type": "number",
                                  "description": "The top edge of the device rectangle"
                              },
                              "bottom": {
                                  "type": "number",
                                  "description": "The bottom edge of the device rectangle"
                              }
                          }
                      },
                      "eyePoint": {
                          "type": "object",
                          "description": "The eyepoint coordinate",
                          "properties": {
                              "x": {
                                  "type": "number",
                                  "description": "The x coordinate of the eyepoint"
                              },
                              "y": {
                                  "type": "number",
                                  "description": "The y coordinate of the eyepoint",
                              }
                          }
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>I managed to make a schema that seems to be close but still doesn't validate it. This is what I tried
  EDIT: it now seems to validate but it won't catch extra fields or missing fields</p>
  
  <pre><code>{
          "id" : "arg",
          "type" : "object",
          "properties" : {
              "type" : { "type" : "string", "optional" : false },
              "description" : { "type" : "string", "optional" : false },
              "properties" : {
                  "type" : "object",
                  "patternProperties" : {
                      "[A-Za-z0-9]" : { "$ref" : "arg" }
                  }
              }
          },
          "additionalProperties" : false
      }
  </code></pre>
  
  <p>Any help would be appreciated</p>