{
  "title": "Query Table DataSource",
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema",
  "description": "Query table data source is a layer/table that is defined by a SQL query.",
  "properties": {
    "geometryType": {
      "type": "string",
      "description": "The geometry type. When querying a table that does not have a geometry column, do not include geometryType.",
      "enum": [
        "esriGeometryMultipoint",
        "esriGeometryPoint",
        "esriGeometryPolygon",
        "esriGeometryPolyline"
      ]
    },
    "oidFields": {
      "type": "string",
      "description": "Comma separated list of identifier fields. There are only certain field types that can be used as a unique identifier. These field types include integer, string, GUID, and date. If a single integer field is specified, map server uses the values in that field directly to uniquely identify all features and rows returned from a queryTable. However, if a single string field or a group of fields is used as the unique identifier, map server maps those unique values to an integer."
    },
    "query": {
      "type": "string",
      "description": "The SQL query."
    },
    "spatialReference": {
      "type": "object",
      "description": "The spatial reference of the geometry column. When querying a table that does not have a geometry column, do not include spatialReference.",
      "$ref": "spatialReference_schema.json"
    },
    "type": {
      "type": "string",
      "description": "String value indicating the type for the dataSource.",
      "enum": [
        "queryTable"
      ]
    },
    "workspaceId": {
      "type": "string",
      "description": "The unique string value used to identify the datasource's workspace."
    }
  },
  "required": [
    "type"
  ],
  "additionalProperties": false,
  "esriDocumentation": {
    "examples": [
      {
        "title": "Query Table dataSource",
        "code": {
          "dataSource": {
            "type": "queryTable",
            "workspaceId": "SqlMAP",
            "oidFields": "taxlotid",
            "query": "SELECT * FROM TaxLots",
            "geometryType": "esriGeometryPolygon",
            "spatialReference": {
              "wkid": 4326
            }
          }
        }
      }
    ]
  }
}
