   create_directory: (mappings, constructors) ->
     for name, mapping of mappings
       do (name, mapping) =>
-        {url, path, template} = mapping
-        # TODO: use a JSON schema for this sort of thing
-        if !(url || path || template)
+        {url, query} = mapping
+        if !(url || query)
           throw new Error "Mapping lacks a url, path, or template field"
-        if constructor = constructors[mapping.resource]
-          if mapping.url && !mapping.query
-            # The API has provided a URL for this resource, so we do not have to
-            # generate it.  This is the expected case for directories coming
-            # from a Patchboard Server.
-            url = mapping.url
-            @resources[name] = new constructor(null, url: url)
-
-          else if mapping.path && !mapping.query
-            url = @generate_url(mapping)
-            @resources[name] = new constructor(null, url: url)
-          else
-            @resources[name] = (params={}) ->
-              new constructor(params)
+        if constructor = constructors[name]
+          if mapping.url
+            if mapping.query
+              @resources[name] = (params={}) ->
+                new constructor(params)
+            else
+              @resources[name] = new constructor(null, url: mapping.url)
         else
           throw new Error "No constructor for '#{name}'"
 

          out.push(part)
      path = out.join("/")
    else if mapping.path
      path = mapping.path
    else if mapping.url
      url = mapping.url

  resource_constructor: ({type, mapping, definition}) ->
    client = @
    constructor = (params, data={}) ->

      if mapping
        {url, path, template, query} = mapping
        url ||= data.url
        data.url = client.generate_url({url, path, template, query}, params)

      for key, value of data
        @[key] = value
      return @

    constructor.prototype._actions = {}
    constructor.prototype.resource_type = type
    if mapping?.query
      constructor.query = mapping.query

    # Hide the Patchboard client from such things as console.log
    Object.defineProperty constructor.prototype, "patchboard_client",
      value: @
