{
  "servicename": "oracledbstore",
  "routes": [
    {
      "route": "/user",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetUser",
      "description": "GetCurrentUser",
      "examples": [
        {
          "param": "/user"
        }
      ]
    },
    {
      "route": "/schemas",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetSchemas",
      "description": "Get schemas in a database",
      "examples": [
        {
          "param": "/schemas"
        }
      ]
    },
    {
      "route": "/schemas",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateSchema",
      "description": "Create Schema with the schema",
      "bodyschema": {
        "type": "object",
        "properties": {
          "required": [
            "schema",
            "password",
            "quota"
          ],
          "schema": {
            "description": "schema name",
            "type": "string"
          },
          "password": {
            "description": "password",
            "type": "string",
            "miniLength": "5"
          },
          "qutoa": {
            "description": "quota for tablespace allocated to store the data within schema in MB",
            "type": "integer",
            "miniimum": "1"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas",
          "payload": {
            "schema": "schema1",
            "password": "cirruswave",
            "quota": 5
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteSchemasSchema",
      "description": "Delete a schema",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "description": "name of the schema",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/schema1"
        }
      ]
    },
    {
      "route": "/tables",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTables",
      "description": "Get all coumns and all rows in a table",
     "examples": [
        {
          "param": "/tables"
        }
      ]
    },
    {
      "route": "/tables",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateTable",
      "description": "Create Table with the schema",
      "bodyschema": {
        "type": "object",
        "properties": {
          "required": [
            "table"
          ],
          "table": {
            "description": "table name",
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "ctype"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "ctype": {
                  "type": "string",
                  "description": "column data type"
                },
                "special": {
                  "type": "string",
                  "description": "optional special strings like null, not null etc. this will append after column name and type are passed to create table"
                },
                "primarykey": {
                  "type": "boolean",
                  "description": "If present this column will be primary key"
                },
                "identity": {
                  "type": "boolean",
                  "description": "if present, this column will represent auto_increment column"
                },
                "foreignkey": {
                  "type": "object",
                  "required": [
                    "table"
                  ],
                  "table": {
                    "type": "string",
                    "description": "the table name the foreign key references"
                  },
                  "column": {
                    "type": "string",
                    "description": "the table column (optional) the foreign key references"
                  }
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/tables",
          "payload": {
            "table": "employees",
            "columns": [
              {
                "column": "emp_id",
                "ctype": "INT",
                "primarykey": true,
                "identity": true,
                "special": "NOT NULL"
              },
              {
                "column": "first_name",
                "ctype": "varchar(255)",
                "special": "NULL"
              },
              {
                "column": "last_name",
                "ctype": "varchar(255)",
                "special": "NOT NULL"
              }
            ]
          }
        },
        {
          "param": "/tables",
          "payload": {
            "table": "salaries",
            "columns": [
              {
                "column": "emp",
                "ctype": "INT",
                "foreignkey": {
                  "table": "employees",
                  "column": "emp_id"
                }
              },
              {
                "column": "salary",
                "ctype": "INT",
                "special": "NOT NULL"
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/tables/:table",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "AlterTable",
      "description": "Add Columns to the table schema",
      "paramschema": {
        "required": [
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "properties": {
          "required": [
            "columns"
          ],
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "ctype"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "ctype": {
                  "type": "string",
                  "description": "column data type"
                },
                "special": {
                  "type": "string",
                  "description": "optional special strings like null, not null etc. this will append after column name and type are passed to create table"
                },
                "index": {
                  "type": {
                    "enum": [
                      "asc",
                      "desc"
                    ]
                  },
                  "description": "there will be an index created for this column. It can be ascendiing or descending. For MySQL server it's always ascending.'"
                },
                "primarykey": {
                  "type": "boolean",
                  "description": "If present this column will be primary key"
                },
                "foreignkey": {
                  "type": "object",
                  "required": [
                    "table"
                  ],
                  "table": {
                    "type": "string",
                    "description": "the table name the foreign key references"
                  },
                  "column": {
                    "type": "string",
                    "description": "the table column (optional) the foreign key references"
                  }
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees",
          "payload": {
            "columns": [
              {
                "column": "age",
                "ctype": "INT"
              },
              {
                "column": "address",
                "ctype": "varchar(255)"
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/tables/:table",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteTableAndSchema",
      "description": "This can only try and delete the table . If there are constraints it will fail.",
      "paramschema": {
        "required": [
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees"
        }
      ]
    },
    {
      "route": "/tables/:table",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableSchema",
      "description": "Get schema for a table",
      "paramschema": {
        "required": [
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees"
        }
      ]
    },
    {
      "route": "/tables/:table/rows",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRows",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "stream": {
            "description": "stream the data instead of sending it",
            "type": "boolean"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rows"
        },
        {
          "param": "/tables/employees/rows?stream"
        },
        {
          "param": "/tables/salaries/rows"
        }
      ]
    },
    {
      "route": "/tables/:table/rows",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "InsertRecord",
      "description": "insert a record into a table",
      "paramschema": {
        "required": [
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "oneOf": [
          {
            "required": [
              "columns"
            ]
          },
          {
            "required": [
              "loaddata",
              "schema"
            ]
          },
          {
            "required": [
              "pathlocal"
            ]
          }
        ],
        "properties": {
          "loaddata": {
            "type": "string",
            "description": "csv data load the data from into the table."
          },
          "schema": {
            "type": "array",
            "description": "schema for the data",
            "items": {
              "type": "object",
              "required": [
                "name",
                "datatype"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "column name"
                },
                "datatype": {
                  "type": "string",
                  "description": "sql data type for the column. Note this has to be exactly the same as the one that the column is create with"
                },
                "special": {
                  "type": "string",
                  "description": "special instructions like pirmary"
                }
              }
            }
          },
          "chunk": {
            "type": "integer",
            "description": "Since load csv can take time chunk can be set to determine the number of rows to do periodic commit to speed up the process. Default value is 1000",
            "minimum": 100
          },
          "map": {
            "type": "array",
            "items": {
              "type": "object",
              "oneOf": [
                {
                  "required": [
                    "source",
                    "type",
                    "destination"
                  ]
                },
                {
                  "required": [
                    "expression",
                    "destination"
                  ]
                },
                {
                  "required": [
                    "default",
                    "destination"
                  ]
                }
              ],
              "properties": {
                "source": {
                  "type": "string"
                },
                "expression": {
                  "type": "string",
                  "description": "special expression (limited javascript expressions) in terms of the column names in csv header. Each occurence of column name is prefixed with $ e.g. $columnName. After the expression is evaluated for each row substituting the actual value in the csv for the $variable. If evaluation is successful it will be the property value otherwise the string will be the property value."
                },
                "default": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Assign the default value to this property. Value can be null"
                },
                "type": {
                  "type": {
                    "enum": [
                      "string",
                      "integer",
                      "number",
                      "boolean",
                      "date",
                      "literal"
                    ]
                  }
                },
                "destination": {
                  "type": "string"
                }
              }
            }
          },
          "ignoreidentity": {
            "type": "boolean",
            "description": "If false or not set, assumes value not explicitly passed for identity columns. If you explicitly pass the value for identity columns set this to true"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "value"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "description": "column value"
                }
              }
            }
          },
          "pathlocal": {
            "type": "string",
            "description": "file path on the sql server to bulk insert from"
          },
          "checkconstraints": {
            "type": "boolean",
            "description": "If true constraints like foreign and primary keys are checked"
          },
          "rowterminator": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2,
            "description": "default is \r\n but can be changed to \n or something else"
          },
          "header": {
            "type": "boolean",
            "description": "true means the first row is header. default is false"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rows",
          "payload": {
            "ignoreidentity": true,
            "columns": [
              {
                "column": "emp_id",
                "value": 1
              },
              {
                "column": "first_name",
                "value": "John"
              },
              {
                "column": "last_name",
                "value": "Doe"
              }
            ]
          }
        },
        {
          "param": "/tables/employees/rows",
          "payload": {
            "columns": [
             {
                "column": "first_name",
                "value": "Jane"
              },
              {
                "column": "last_name",
                "value": "Eyre"
              }
            ]
          }
        },
        {
          "param": "/tables/employees/rows",
          "payload": {
            "loaddata": "\"david\",\"blum\"\n\"jane\",\"dar\"\n\"darin\",\"hatake\"\n\"lauren\",\"gyro\"\n\"lina\",\"carr\"\n",
            "schema": [
              {
                "name": "first_name",
                "datatype": "varchar(255)",
                "special": "NULL"
              },
              {
                "name": "last_name",
                "datatype": "varchar(255)",
                "special": "NOT NULL"
              }
            ]
          }
        },
        {
          "param": "/tables/salaries/rows",
          "payload": {
            "columns": [
              {
                "column": "emp",
                "value": 1
              },
              {
                "column": "salary",
                "value": 100000
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/tables/:table/rows/limits/:offset/:limit/:orderby",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowsLimit",
      "description": "Get all coumns and all rows in a table from offset upto limit",
      "paramschema": {
        "required": [
          "table",
          "offset",
          "limit",
          "orderby"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "offset": {
            "description": "offset",
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "description": "limit",
            "type": "integer",
            "minimum": 1
          },
          "orderby": {
            "description": "column name to order by",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rows/limits/1/100/emp_id"
        },
        {
          "param": "/tables/salaries/rows/limits/1/100/emp"
        }
      ]
    },
    {
      "route": "/tables/{table}/rowcount",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowCount",
      "description": "Get the row count for the table",
      "paramschema": {
        "required": [          
          "table"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rowcount"
        },
        {
          "param": "/tables/salaries/rowcount"
        }
      ]
    },
    {
      "route": "/tables/:table/rows/:field/:value",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowsRow",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "table",
          "field",
          "value"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "field": {
            "description": "column name",
            "type": "string"
          },
          "value": {
            "description": "value for the column can be any value"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rows/emp_id/1"
        }
      ]
    },
    {
      "route": "/tables/:table/rows/:field/:value",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteTableRowsRow",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "table",
          "field",
          "value"
        ],
        "type": "object",
        "properties": {
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "field": {
            "description": "column name",
            "type": "string"
          },
          "value": {
            "description": "value for the column can be any value"
          }
        }
      },
      "examples": [
        {
          "param": "/tables/employees/rows/emp_id/1"
        }
      ]
    },
    {
      "route": "/functions",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetFunctions",
      "description": "List all the Functions in the database",
      "examples": [
        {
          "param": "/functions"
        }
      ]
    },
    {
      "route": "/functions",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateFunction",
      "description": "Create a function in the database",
      "bodyschema": {
        "required": [
          "name",
          "body"
        ],
        "type": "object",
        "properties": {
          "required": [
            "name"
          ],
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "name of the function"
          },
          "body": {
            "type": "string",
            "minLength": 1
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          },
          "returns": {
            "type": "string",
            "description": "can be literal word table or scalar value only"
          }
        }
      },
      "examples": [
        {
          "param": "/functions",
          "payload": {
            "name": "Hello",
            "returns": "varchar2",
            "body": "return 'hello'; "
          }
        },
        {
          "param": "/functions",
          "payload": {
            "name": "prodfunc",
            "params": [
              {
                "name": "x",
                "type": "number"
              },
              {
                "name": "y",
                "type": "number"
              }
            ],
            "declare": "retval number;",
            "body": "retval := x*y; return retval;",
            "returns": "number"
          }
        },
        {
          "param": "/functions",
          "payload": {
            "name": "sumfunc",
            "params": [
              {
                "name": "x",
                "type": "number(5,2)"
              },
              {
                "name": "y",
                "type": "number(5,2)"
              }
            ],
            "body": "return  x+y;"
          }
        }
      ]
    },
    {
      "route": "/functions/:name",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetFunctionDetails",
      "description": "Get storedprocedure details in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "name of the function",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/functions/prodfunc"
        },
        {
          "param": "/functions/sumfunc"
        }
      ]
    },
    {
      "route": "/functions/:name",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteFunction",
      "description": "Delete storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "name of the function",
            "type": "string",
            "minLength": 1
          },
          "parameters": {
            "description": "optional parameter types passed as query paramters. Postgresql supports overloading functions and storeprocs. These are necessary if the functiosn are overloaded to distinguish.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        }
      },
      "examples": [
        {
          "param": "/functions/prodfunc?parameters=int&parameters=int"
        },
        {
          "param": "/functions/sumfunc"
        },
        {
          "param": "/functions/testsp?parameters=int"
        },
        {
          "param": "/functions/testsp"
        }
      ]
    },
    {
      "route": "/functions/:name",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "ExecFunction",
      "description": "Execute function in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "bodyschema": {
        "required": [
          "params"
        ],
        "type": "object",
        "properties": {
          "prestatements": {
            "type": "string",
            "minLength": 0
          },
          "poststatements": {
            "type": "string",
            "minLength": 0
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name if mode is in, out, or inout and value if mode is lieteral"
                },
                "value": {
                  "type": "string",
                  "description": "parameter value only used if mode is in or inout"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout",
                      "literal"
                    ]
                  },
                  "description": "parameter mode which is in, out, inout, or literal"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/functions/Hello",
          "payload": {
            "params": [
            ]
          }
        },
        {
          "param": "/functions/prodfunc",
          "payload": {
            "params": [
              {
                "name": "x",
                "mode": "in",
                "type": "number(5,2)",
                "value": "6"
              },
              {
                "name": "y",
                "type": "number(5,2)",
                "mode": "in",
                "value": "7"
              }
            ]
          }
        },
        {
          "param": "/functions/sumfunc",
          "payload": {
            "params": [
              {
                "name": "x",
                "mode": "in",
                "type": "number(5,2)",
                "value": "6"
              },
              {
                "name": "y",
                "type": "number(5,2)",
                "mode": "in",
                "value": "7"
              }
            ]
          }
        },
        {
          "param": "/functions/sel",
          "payload": {
            "params": [
            ]
          }
        }

      ]
    },
    {
      "route": "/storedprocs",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetSPs",
      "description": "List all the stored procedure in the database",
      "examples": [
        {
          "param": "/storedprocs"
        }
      ]
    },
    {
      "route": "/storedprocs",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateSP",
      "description": "Create a stored procedure in the database",
      "bodyschema": {
        "required": [
          "name",
          "body"
        ],
        "type": "object",
        "properties": {
          "required": [
            "name"
          ],
          "name": {
            "type": "string",
            "minLength": 1
          },
          "declare": {
            "type": "string",
            "minLength": 1
          },
          "body": {
            "type": "string",
            "minLength": 1
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout"
                    ]
                  },
                  "description": "column value"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/storedprocs",
          "payload": {
            "name": "AddEmployee",
            "params": [
              {
                "name": "fn",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "ln",
                "mode": "in",
                "type": "varchar"
              }
            ],
            "body": "insert into employees (first_name, last_name) values(fn, ln);"
          }
        },
        {
          "param": "/storedprocs",
          "payload": {
            "name": "AddEmployeeWithSelect",
            "params": [
              {
                "name": "fn",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "ln",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "cur",
                "mode": "out",
                "type": "SYS_REFCURSOR"
              }
          ],
            "body": "insert into employees (first_name, last_name) values(fn, ln); OPEN cur FOR select * from employees;"
          }
        },
        {
          "param": "/storedprocs",
          "payload": {
            "name": "FetchEmployees",
            "params": [
              {
                "name": "cur",
                "mode": "out",
                "type": "SYS_REFCURSOR"
              }
            ],
            "body": "OPEN cur FOR select * from employees;"
          }
        },
        {
          "param": "/storedprocs",
          "payload": {
            "name": "DeleteEmployee",
            "params": [
              {
                "name": "id",
                "mode": "in",
                "type": "INT"
              }
            ],
            "body": "delete from ADMIN.employees where emp_id = @id;"
          }
        },
        {
          "param": "/storedprocs",
          "payload": {
            "name": "testsp",
            "params": [
              {
                "name": "param1",
                "mode": "in",
                "type": "number(5,2)"
              },
              {
                "name": "param2",
                "mode": "out",
                "type": "number(5,2)"
              }
            ],
            "body": "SELECT * from Employees; SET @param2 = @param1 + 20;"
          }
        }
      ]
    },
    {
      "route": "/storedprocs/:name",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetSPDetails",
      "description": "Get storedprocedure details in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "database": {
            "description": "name of the database",
            "type": "string",
            "minLength": 1
          },
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/storedprocs/AddEmployee"
        },
        {
          "param": "/storedprocs/AddEmployeeWithSelect"
        },
        {
          "param": "/storedprocs/FetchEmployees"
        },
        {
          "param": "/storedprocs/DeleteEmployee"
        },
        {
          "param": "/storedprocs/testsp"
        }
      ]
    },
    {
      "route": "/storedprocs/:name",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteSP",
      "description": "Delete storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/storedprocs/AddEmployee"
        },
        {
          "param": "/storedprocs/AddEmployeeWithSelect"
        },
        {
          "param": "/storedprocs/FetchEmployees"
        },
        {
          "param": "/storedprocs/DeleteEmployee"
        },
        {
          "param": "/storedprocs/testsp"
        }
      ]
    },
    {
      "route": "/storedprocs/:name",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "ExecSP",
      "description": "Execute storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "properties": {
          "prestatements": {
            "type": "string",
            "minLength": 0
          },
          "poststatements": {
            "type": "string",
            "minLength": 0
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name if mode is in, out, or inout and value if mode is lieteral"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout",
                      "literal"
                    ]
                  },
                  "description": "parameter mode which is in, out, inout, or literal"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/storedprocs/AddEmployee",
          "payload": {
            "params": [
              {
                "name": "firstname",
                "mode": "in",
                "value": "Vinay"
              },
              {
                "name": "lastname",
                "mode": "in",
                "value": "David"
              }
            ]
          }
        },
        {
          "param": "/storedprocs/AddEmployeeWithSelect",
          "payload": {
            "params": [
              {
                "name": "firstname",
                "mode": "in",
                "value": "Vinay"
              },
              {
                "name": "lastname",
                "mode": "in",
                "value": "David"
              },
              {
                "name": "cur",
                "mode": "out",
                "type": "CURSOR"
              }
            ]
          }
        },
        {
          "param": "/storedprocs/FetchEmployees",
          "payload": {
            "params": [
              {
                "name": "cur",
                "mode": "out",
                "type": "CURSOR"
              }
            ]
          }
        },
        {
          "param": "/storedprocs/DeleteEmployee",
          "payload": {
            "prestatements": "",
            "poststatements": "select * from ADMIN.employees;",
            "params": [
              {
                "name": "id",
                "mode": "in",
                "value": "2"
              }
            ]
          }
        },
        {
          "param": "/storedprocs/testsp",
          "payload": {
            "name": "testsp",
            "prestatements": "",
            "poststatements": "",
            "params": [
              {
                "name": "var1",
                "mode": "in",
                "type": "number(5,2)",
                "value": "10.025"
              },
              {
                "name": "var2",
                "type": "number(5,2)",
                "mode": "out"
              }
            ]
          }
        },
        {
          "param": "/storedprocs/testsp",
          "payload": {
            "name": "testsp",
            "prestatements": "declare @var3 number(5,2) set @var3 = 5.1;",
            "poststatements": "select @var2+@var3 as var",
            "params": [
              {
                "name": "var1",
                "mode": "in",
                "type": "number(5,2)",
                "value": "10.025"
              },
              {
                "name": "var2",
                "type": "number(5,2)",
                "mode": "out"
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/execstatements",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GeneralQuery",
      "description": "Execute statements given as a strig with ; as delimeter",
      "bodyschema": {
        "required": [
          "statements"
        ],
        "type": "object",
        "properties": {
          "statements": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/execstatements",
          "payload": {
            "statements": "Select * from user_errors where name='ADDEMPLOYEE'"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "select * from employees where emp_id=1"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "select * from sales limit 10"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "select * from features limit 10"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "select * from stores limit 10"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "insert into employees (emp_id, first_name, last_name) values(2, \"Roger\", \"Meyer\"); select * from employees"
          }
        },
        {
          "param": "/execstatements",
          "payload": {
            "statements": "select * from employees limit 10"
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTables",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          }
        }
      },
     "examples": [
        {
          "param": "/schemas/SCHEMA1/tables"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateTable",
      "description": "Create Table with the schema",
      "bodyschema": {
        "type": "object",
        "properties": {
          "required": [
            "schema",
            "table"
          ],
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "table name",
            "type": "string"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "ctype"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "ctype": {
                  "type": "string",
                  "description": "column data type"
                },
                "special": {
                  "type": "string",
                  "description": "optional special strings like null, not null etc. this will append after column name and type are passed to create table"
                },
                "primarykey": {
                  "type": "boolean",
                  "description": "If present this column will be primary key"
                },
                "identity": {
                  "type": "boolean",
                  "description": "if present, this column will represent auto_increment column"
                },
                "foreignkey": {
                  "type": "object",
                  "required": [
                    "table"
                  ],
                  "table": {
                    "type": "string",
                    "description": "the table name the foreign key references"
                  },
                  "column": {
                    "type": "string",
                    "description": "the table column (optional) the foreign key references"
                  }
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables",
          "payload": {
            "table": "employees",
            "columns": [
              {
                "column": "emp_id",
                "ctype": "INT",
                "primarykey": true,
                "identity": true,
                "special": "NOT NULL"
              },
              {
                "column": "first_name",
                "ctype": "varchar(255)",
                "special": "NULL"
              },
              {
                "column": "last_name",
                "ctype": "varchar(255)",
                "special": "NOT NULL"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/tables",
          "payload": {
            "table": "salaries",
            "columns": [
              {
                "column": "emp",
                "ctype": "INT",
                "foreignkey": {
                  "table": "employees",
                  "column": "emp_id"
                }
              },
              {
                "column": "salary",
                "ctype": "INT",
                "special": "NOT NULL"
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "AlterTable",
      "description": "Add Columns to the table schema",
      "paramschema": {
        "required": [
          "schema",
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "properties": {
          "required": [
            "columns"
          ],
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "ctype"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "ctype": {
                  "type": "string",
                  "description": "column data type"
                },
                "special": {
                  "type": "string",
                  "description": "optional special strings like null, not null etc. this will append after column name and type are passed to create table"
                },
                "index": {
                  "type": {
                    "enum": [
                      "asc",
                      "desc"
                    ]
                  },
                  "description": "there will be an index created for this column. It can be ascendiing or descending. For MySQL server it's always ascending.'"
                },
                "primarykey": {
                  "type": "boolean",
                  "description": "If present this column will be primary key"
                },
                "foreignkey": {
                  "type": "object",
                  "required": [
                    "table"
                  ],
                  "table": {
                    "type": "string",
                    "description": "the table name the foreign key references"
                  },
                  "column": {
                    "type": "string",
                    "description": "the table column (optional) the foreign key references"
                  }
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees",
          "payload": {
            "columns": [
              {
                "column": "age",
                "ctype": "INT"
              },
              {
                "column": "address",
                "ctype": "varchar(255)"
              }
            ]
          }
        }
      ]
    },    
    {
      "route": "/schemas/:schema/tables/:table",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteTableAndSchema",
      "description": "This can only try and delete the table . If there are constraints it will fail.",
      "paramschema": {
        "required": [
          "schema",
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees"
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableSchema",
      "description": "Get schema for a table",
      "paramschema": {
        "required": [
          "schema",
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees"
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table/rows",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRows",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "schema",
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "stream": {
            "description": "stream the data instead of sending it",
            "type": "boolean"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows"
        },
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows?stream"
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries/rows"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table/rows",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "InsertRecord",
      "description": "insert a record into a table",
      "paramschema": {
        "required": [
          "schema",
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "oneOf": [
          {
            "required": [
              "columns"
            ]
          },
          {
            "required": [
              "loaddata",
              "schema"
            ]
          },
          {
            "required": [
              "pathlocal"
            ]
          }
        ],
        "properties": {
          "loaddata": {
            "type": "string",
            "description": "csv data load the data from into the table."
          },
          "schema": {
            "type": "array",
            "description": "schema for the data",
            "items": {
              "type": "object",
              "required": [
                "name",
                "datatype"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "column name"
                },
                "datatype": {
                  "type": "string",
                  "description": "sql data type for the column. Note this has to be exactly the same as the one that the column is create with"
                },
                "special": {
                  "type": "string",
                  "description": "special instructions like pirmary"
                }
              }
            }
          },
          "chunk": {
            "type": "integer",
            "description": "Since load csv can take time chunk can be set to determine the number of rows to do periodic commit to speed up the process. Default value is 1000",
            "minimum": 100
          },
          "map": {
            "type": "array",
            "items": {
              "type": "object",
              "oneOf": [
                {
                  "required": [
                    "source",
                    "type",
                    "destination"
                  ]
                },
                {
                  "required": [
                    "expression",
                    "destination"
                  ]
                },
                {
                  "required": [
                    "default",
                    "destination"
                  ]
                }
              ],
              "properties": {
                "source": {
                  "type": "string"
                },
                "expression": {
                  "type": "string",
                  "description": "special expression (limited javascript expressions) in terms of the column names in csv header. Each occurence of column name is prefixed with $ e.g. $columnName. After the expression is evaluated for each row substituting the actual value in the csv for the $variable. If evaluation is successful it will be the property value otherwise the string will be the property value."
                },
                "default": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Assign the default value to this property. Value can be null"
                },
                "type": {
                  "type": {
                    "enum": [
                      "string",
                      "integer",
                      "number",
                      "boolean",
                      "date",
                      "literal"
                    ]
                  }
                },
                "destination": {
                  "type": "string"
                }
              }
            }
          },
          "ignoreidentity": {
            "type": "boolean",
            "description": "If false or not set, assumes value not explicitly passed for identity columns. If you explicitly pass the value for identity columns set this to true"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "column",
                "value"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "description": "column name"
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "description": "column value"
                }
              }
            }
          },
          "pathlocal": {
            "type": "string",
            "description": "file path on the sql server to bulk insert from"
          },
          "checkconstraints": {
            "type": "boolean",
            "description": "If true constraints like foreign and primary keys are checked"
          },
          "rowterminator": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2,
            "description": "default is \r\n but can be changed to \n or something else"
          },
          "header": {
            "type": "boolean",
            "description": "true means the first row is header. default is false"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows",
          "payload": {
            "ignoreidentity": true,
            "columns": [
              {
                "column": "emp_id",
                "value": 1
              },
              {
                "column": "first_name",
                "value": "John"
              },
              {
                "column": "last_name",
                "value": "Doe"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows",
          "payload": {
            "columns": [
             {
                "column": "first_name",
                "value": "Jane"
              },
              {
                "column": "last_name",
                "value": "Eyre"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows",
          "payload": {
            "loaddata": "\"david\",\"blum\"\n\"jane\",\"dar\"\n\"darin\",\"hatake\"\n\"lauren\",\"gyro\"\n\"lina\",\"carr\"\n",
            "schema": [
              {
                "name": "first_name",
                "datatype": "varchar(255)",
                "special": "NULL"
              },
              {
                "name": "last_name",
                "datatype": "varchar(255)",
                "special": "NOT NULL"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries/rows",
          "payload": {
            "columns": [
              {
                "column": "emp",
                "value": 1
              },
              {
                "column": "salary",
                "value": 100000
              }
            ]
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table/rows/limits/:offset/:limit/:orderby",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowsLimit",
      "description": "Get all coumns and all rows in a table from offset upto limit",
      "paramschema": {
        "required": [
          "schema",
          "table",
          "offset",
          "limit",
          "orderby"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "offset": {
            "description": "offset",
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "description": "limit",
            "type": "integer",
            "minimum": 1
          },
          "orderby": {
            "description": "column name to order by",
            "type": "string"
          }    
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows/limits/1/100/emp_id"
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries/rows/limits/1/100/emp"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/{table}/rowcount",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowCount",
      "description": "Get the row count for the table",
      "paramschema": {
        "required": [ 
          "schema",         
          "table"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rowcount"
        },
        {
          "param": "/schemas/SCHEMA1/tables/salaries/rowcount"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table/rows/:field/:value",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetTableRowsRow",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "schema",
          "table",
          "field",
          "value"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "field": {
            "description": "column name",
            "type": "string"
          },
          "value": {
            "description": "value for the column can be any value"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows/emp_id/1"
        }
      ]
    },
    {
      "route": "/schemas/:schema/tables/:table/rows/:field/:value",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteTableRowsRow",
      "description": "Get all coumns and all rows in a table",
      "paramschema": {
        "required": [
          "schema",
          "table",
          "field",
          "value"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "table": {
            "description": "name of the table",
            "type": "string"
          },
          "field": {
            "description": "column name",
            "type": "string"
          },
          "value": {
            "description": "value for the column can be any value"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/tables/employees/rows/emp_id/1"
        }
      ]
    },
    {
      "route": "/schemas/:schema/functions",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetFunctions",
      "description": "List all the Functions in the database",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/functions"
        }
      ]
    },
    {
      "route": "/schemas/:schema/functions",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateFunction",
      "description": "Create a function in the database",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          }
        }
      },
      "bodyschema": {
        "required": [
          "name",
          "body"
        ],
        "type": "object",
        "properties": {
          "required": [
            "name"
          ],
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "name of the function"
          },
          "body": {
            "type": "string",
            "minLength": 1
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          },
          "returns": {
            "type": "string",
            "description": "can be literal word table or scalar value only"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/functions",
          "payload": {
            "name": "Hello",
            "returns": "varchar2",
            "body": "return 'hello'; "
          }
        },
        {
          "param": "/schemas/SCHEMA1/functions",
          "payload": {
            "name": "prodfunc",
            "params": [
              {
                "name": "x",
                "type": "number"
              },
              {
                "name": "y",
                "type": "number"
              }
            ],
            "declare": "retval number;",
            "body": "retval := x*y; return retval;",
            "returns": "number"
          }
        },
        {
          "param": "/schemas/SCHEMA1/functions",
          "payload": {
            "name": "sumfunc",
            "params": [
              {
                "name": "x",
                "type": "number(5,2)"
              },
              {
                "name": "y",
                "type": "number(5,2)"
              }
            ],
            "body": "return  x+y;"
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema/functions/:name",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetFunctionDetails",
      "description": "Get storedprocedure details in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the function",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/functions/prodfunc"
        },
        {
          "param": "/schemas/SCHEMA1/functions/sumfunc"
        }
      ]
    },
    {
      "route": "/schemas/:schema/functions/:name",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteFunction",
      "description": "Delete storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the function",
            "type": "string",
            "minLength": 1
          },
          "parameters": {
            "description": "optional parameter types passed as query paramters. Postgresql supports overloading functions and storeprocs. These are necessary if the functiosn are overloaded to distinguish.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/functions/prodfunc?parameters=int&parameters=int"
        },
        {
          "param": "/schemas/SCHEMA1/functions/sumfunc"
        },
        {
          "param": "/schemas/SCHEMA1/functions/testsp?parameters=int"
        },
        {
          "param": "/schemas/SCHEMA1/functions/testsp"
        }
      ]
    },
    {
      "route": "/schemas/:schema/functions/:name",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "ExecFunction",
      "description": "Execute function in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "bodyschema": {
        "required": [
          "params"
        ],
        "type": "object",
        "properties": {
          "prestatements": {
            "type": "string",
            "minLength": 0
          },
          "poststatements": {
            "type": "string",
            "minLength": 0
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name if mode is in, out, or inout and value if mode is lieteral"
                },
                "value": {
                  "type": "string",
                  "description": "parameter value only used if mode is in or inout"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout",
                      "literal"
                    ]
                  },
                  "description": "parameter mode which is in, out, inout, or literal"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/functions/Hello",
          "payload": {
            "params": [
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/functions/prodfunc",
          "payload": {
            "params": [
              {
                "name": "x",
                "mode": "in",
                "type": "number(5,2)",
                "value": "6"
              },
              {
                "name": "y",
                "type": "number(5,2)",
                "mode": "in",
                "value": "7"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/functions/sumfunc",
          "payload": {
            "params": [
              {
                "name": "x",
                "mode": "in",
                "type": "number(5,2)",
                "value": "6"
              },
              {
                "name": "y",
                "type": "number(5,2)",
                "mode": "in",
                "value": "7"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/functions/sel",
          "payload": {
            "params": [
            ]
          }
        }
    
      ]
    },
    {
      "route": "/schemas/:schema/storedprocs",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetSPs",
      "description": "List all the stored procedure in the database",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/storedprocs"
        }
      ]
    },
    {
      "route": "/schemas/:schema/storedprocs",
      "configured": true,
      "type": "post",
      "routeclass": "./oracledbstore.js",
      "routefunction": "CreateSP",
      "description": "Create a stored procedure in the database",
      "paramschema": {
        "required": [
          "schema"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          }
        }
      },
      "bodyschema": {
        "required": [
          "name",
          "body"
        ],
        "type": "object",
        "properties": {
          "required": [
            "name"
          ],
          "name": {
            "type": "string",
            "minLength": 1
          },
          "declare": {
            "type": "string",
            "minLength": 1
          },
          "body": {
            "type": "string",
            "minLength": 1
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode",
                "type"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout"
                    ]
                  },
                  "description": "column value"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/storedprocs",
          "payload": {
            "name": "AddEmployee",
            "params": [
              {
                "name": "fn",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "ln",
                "mode": "in",
                "type": "varchar"
              }
            ],
            "body": "insert into employees (first_name, last_name) values(fn, ln);"
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs",
          "payload": {
            "name": "AddEmployeeWithSelect",
            "params": [
              {
                "name": "fn",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "ln",
                "mode": "in",
                "type": "varchar"
              },
              {
                "name": "cur",
                "mode": "out",
                "type": "SYS_REFCURSOR"
              }
          ],
            "body": "insert into employees (first_name, last_name) values(fn, ln); OPEN cur FOR select * from employees;"
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs",
          "payload": {
            "name": "FetchEmployees",
            "params": [
              {
                "name": "cur",
                "mode": "out",
                "type": "SYS_REFCURSOR"
              }
            ],
            "body": "OPEN cur FOR select * from employees;"
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs",
          "payload": {
            "name": "DeleteEmployee",
            "params": [
              {
                "name": "id",
                "mode": "in",
                "type": "INT"
              }
            ],
            "body": "delete from ADMIN.employees where emp_id = @id;"
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs",
          "payload": {
            "name": "testsp",
            "params": [
              {
                "name": "param1",
                "mode": "in",
                "type": "number(5,2)"
              },
              {
                "name": "param2",
                "mode": "out",
                "type": "number(5,2)"
              }
            ],
            "body": "SELECT * from Employees; SET @param2 = @param1 + 20;"
          }
        }
      ]
    },
    {
      "route": "/schemas/:schema/storedprocs/:name",
      "configured": true,
      "type": "get",
      "routeclass": "./oracledbstore.js",
      "routefunction": "GetSPDetails",
      "description": "Get storedprocedure details in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployee"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployeeWithSelect"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/FetchEmployees"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/DeleteEmployee"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/testsp"
        }
      ]
    },
    {
      "route": "/schemas/:schema/storedprocs/:name",
      "configured": true,
      "type": "delete",
      "routeclass": "./oracledbstore.js",
      "routefunction": "DeleteSP",
      "description": "Delete storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployee"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployeeWithSelect"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/FetchEmployees"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/DeleteEmployee"
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/testsp"
        }
      ]
    },
    {
      "route": "/schemas/:schema/storedprocs/:name",
      "configured": true,
      "type": "put",
      "routeclass": "./oracledbstore.js",
      "routefunction": "ExecSP",
      "description": "Execute storedprocedure in the database with the name",
      "paramschema": {
        "required": [
          "schema",
          "name"
        ],
        "type": "object",
        "properties": {
          "schema": {
            "type": "string",
            "description": "schema name"
          },
          "name": {
            "description": "name of the stored procedure",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "bodyschema": {
        "type": "object",
        "properties": {
          "prestatements": {
            "type": "string",
            "minLength": 0
          },
          "poststatements": {
            "type": "string",
            "minLength": 0
          },
          "params": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "mode"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "parameter name if mode is in, out, or inout and value if mode is lieteral"
                },
                "mode": {
                  "type": {
                    "enum": [
                      "in",
                      "out",
                      "inout",
                      "literal"
                    ]
                  },
                  "description": "parameter mode which is in, out, inout, or literal"
                },
                "type": {
                  "type": "string",
                  "minLength": 1,
                  "description": "sql compatible datatypes"
                }
              }
            }
          }
        }
      },
      "examples": [
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployee",
          "payload": {
            "params": [
              {
                "name": "firstname",
                "mode": "in",
                "value": "Vinay"
              },
              {
                "name": "lastname",
                "mode": "in",
                "value": "David"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/AddEmployeeWithSelect",
          "payload": {
            "params": [
              {
                "name": "firstname",
                "mode": "in",
                "value": "Vinay"
              },
              {
                "name": "lastname",
                "mode": "in",
                "value": "David"
              },
              {
                "name": "cur",
                "mode": "out",
                "type": "CURSOR"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/FetchEmployees",
          "payload": {
            "params": [
              {
                "name": "cur",
                "mode": "out",
                "type": "CURSOR"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/DeleteEmployee",
          "payload": {
            "prestatements": "",
            "poststatements": "select * from ADMIN.employees;",
            "params": [
              {
                "name": "id",
                "mode": "in",
                "value": "2"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/testsp",
          "payload": {
            "name": "testsp",
            "prestatements": "",
            "poststatements": "",
            "params": [
              {
                "name": "var1",
                "mode": "in",
                "type": "number(5,2)",
                "value": "10.025"
              },
              {
                "name": "var2",
                "type": "number(5,2)",
                "mode": "out"
              }
            ]
          }
        },
        {
          "param": "/schemas/SCHEMA1/storedprocs/testsp",
          "payload": {
            "name": "testsp",
            "prestatements": "declare @var3 number(5,2) set @var3 = 5.1;",
            "poststatements": "select @var2+@var3 as var",
            "params": [
              {
                "name": "var1",
                "mode": "in",
                "type": "number(5,2)",
                "value": "10.025"
              },
              {
                "name": "var2",
                "type": "number(5,2)",
                "mode": "out"
              }
            ]
          }
        }
      ]
    }
  ],
  "loglevel": "trace"
}