content: {
    "$defs": {
      "action": {
        "oneOf": [
          {
            "enum": [
              "create",
              "read",
              "update",
              "delete"
            ],
            "type": "string"
          },
          {
            "pattern": "[*]",
            "type": "string"
          }
        ]
      },
      "singular-plural": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "additionalProperties": false,
            "properties": {
              "plural": {
                "type": "string"
              },
              "singular": {
                "type": "string"
              }
            },
            "required": [
              "singular"
            ],
            "type": "object"
          }
        ]
      }
    },
    "$id": "https://github.com/Azure/data-api-builder/releases/download/vmajor.minor.patch/dab.draft.schema.json",
    "$schema": "https://json-schema.org/draft-07/schema",
    "additionalProperties": false,
    "description": "Schema for Data API builder engine",
    "properties": {
      "$schema": {
        "default": null,
        "description": "URI of the JSON schema with which the structure, constraints, and data types of this Data API builder runtime configuration file should conform.",
        "type": "string"
      },
      "data-source": {
        "additionalProperties": false,
        "allOf": [
          {
            "if": {
              "properties": {
                "database-type": {
                  "const": "cosmosdb_nosql"
                }
              }
            },
            "then": {
              "properties": {
                "options": {
                  "additionalProperties": false,
                  "description": "Database specific properties for the backend database",
                  "properties": {
                    "container": {
                      "description": "Name of the container",
                      "type": "string"
                    },
                    "database": {
                      "description": "Name of the database",
                      "type": "string"
                    },
                    "schema": {
                      "description": "Path to the GraphQL schema file",
                      "type": "string"
                    }
                  },
                  "required": [
                    "database",
                    "schema"
                  ],
                  "type": "object"
                }
              },
              "required": [
                "options"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "database-type": {
                  "const": "mssql"
                }
              }
            },
            "then": {
              "properties": {
                "options": {
                  "additionalProperties": false,
                  "properties": {
                    "set-session-context": {
                      "description": "Enable sending data to MsSql using session context",
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              },
              "required": []
            }
          },
          {
            "if": {
              "properties": {
                "database-type": {
                  "enum": [
                    "mysql",
                    "postgresql",
                    "cosmosdb_postgresql"
                  ]
                }
              }
            },
            "then": {
              "properties": {
                "options": {
                  "additionalProperties": false,
                  "properties": {},
                  "required": [],
                  "type": "object"
                }
              }
            }
          }
        ],
        "description": "Data source information",
        "properties": {
          "connection-string": {
            "description": "Connection string for the selected database type",
            "type": "string"
          },
          "database-type": {
            "description": "Database used in the backend",
            "enum": [
              "mssql",
              "postgresql",
              "mysql",
              "cosmosdb_nosql",
              "cosmosdb_postgresql"
            ],
            "type": "string"
          },
          "options": {
            "description": "Database specific properties for the backend database",
            "type": "object"
          }
        },
        "required": [
          "database-type",
          "connection-string"
        ],
        "type": "object"
      },
      "data-source-files": {
        "default": null,
        "description": "Names of runtime configuration files referencing additional databases.",
        "type": "array"
      },
      "entities": {
        "description": "Entities that will be exposed via REST and/or GraphQL",
        "patternProperties": {
          "^.*$": {
            "additionalProperties": false,
            "else": {
              "properties": {
                "permissions": {
                  "description": "Permissions assigned to this object",
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "actions": {
                        "oneOf": [
                          {
                            "pattern": "[*]",
                            "type": "string"
                          },
                          {
                            "items": {
                              "oneOf": [
                                {
                                  "enum": [
                                    "execute",
                                    "*"
                                  ],
                                  "type": "string"
                                },
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "action": {
                                      "enum": [
                                        "execute",
                                        "*"
                                      ],
                                      "type": "string"
                                    },
                                    "fields": {
                                      "additionalProperties": false,
                                      "properties": {
                                        "exclude": {
                                          "items": {
                                            "type": "string"
                                          },
                                          "type": "array"
                                        },
                                        "include": {
                                          "items": {
                                            "type": "string"
                                          },
                                          "type": "array"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "policy": {
                                      "additionalProperties": false,
                                      "description": "Define item-level security policy",
                                      "properties": {
                                        "database": {
                                          "type": "string"
                                        }
                                      },
                                      "type": "object"
                                    }
                                  },
                                  "type": "object"
                                }
                              ]
                            },
                            "type": "array",
                            "uniqueItems": true
                          }
                        ]
                      },
                      "role": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "required": [
                    "role",
                    "actions"
                  ],
                  "type": "array"
                }
              }
            },
            "if": {
              "properties": {
                "source": {
                  "properties": {
                    "type": {
                      "oneOf": [
                        {
                          "const": "table"
                        },
                        {
                          "const": "view"
                        }
                      ]
                    }
                  }
                }
              }
            },
            "properties": {
              "cache": {
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "default": false,
                    "description": "Enable caching of responses for this entity.",
                    "type": "boolean"
                  },
                  "ttl-seconds": {
                    "default": 5,
                    "description": "Time to live in seconds",
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "graphql": {
                "oneOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "additionalProperties": false,
                    "anyOf": [
                      {
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "required": [
                          "operation"
                        ]
                      },
                      {
                        "required": [
                          "enabled"
                        ]
                      }
                    ],
                    "properties": {
                      "enabled": {
                        "default": true,
                        "description": "Allow enabling/disabling GraphQL requests for this specific entity.",
                        "type": "boolean"
                      },
                      "operation": {
                        "enum": [
                          "mutation",
                          "query"
                        ],
                        "type": "string"
                      },
                      "type": {
                        "$ref": "#/$defs/singular-plural"
                      }
                    },
                    "type": "object"
                  }
                ]
              },
              "mappings": {
                "description": "Define mappings between database fields and GraphQL and REST fields",
                "patternProperties": {
                  "^.*$": {
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "permissions": {
                "description": "Permissions assigned to this entity",
                "type": "array"
              },
              "relationships": {
                "patternProperties": {
                  "^.*$": {
                    "additionalProperties": false,
                    "properties": {
                      "cardinality": {
                        "enum": [
                          "one",
                          "many"
                        ],
                        "type": "string"
                      },
                      "linking.object": {
                        "description": "The database object used for supporting the M:N relationship",
                        "type": "string"
                      },
                      "linking.source.fields": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "linking.target.fields": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "source.fields": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "target.entity": {
                        "type": "string"
                      },
                      "target.fields": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "cardinality",
                      "target.entity"
                    ]
                  }
                },
                "type": "object"
              },
              "rest": {
                "oneOf": [
                  {
                    "type": "boolean"
                  },
                  {
                    "additionalProperties": false,
                    "anyOf": [
                      {
                        "required": [
                          "path"
                        ]
                      },
                      {
                        "required": [
                          "methods"
                        ]
                      },
                      {
                        "required": [
                          "enabled"
                        ]
                      }
                    ],
                    "properties": {
                      "enabled": {
                        "default": true,
                        "description": "Allow enabling/disabling REST requests this specific entity.",
                        "type": "boolean"
                      },
                      "methods": {
                        "items": {
                          "enum": [
                            "get",
                            "post",
                            "put",
                            "patch",
                            "delete"
                          ],
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "path": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                ]
              },
              "source": {
                "oneOf": [
                  {
                    "description": "The object in the backend database that is mapped to the entity",
                    "type": "string"
                  },
                  {
                    "additionalProperties": false,
                    "description": "The object in the backend database that is mapped to the entity",
                    "properties": {
                      "key-fields": {
                        "description": "List of fields to be used as primary keys. Mandatory field for views when generated through the CLI.",
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "object": {
                        "description": "Database object name",
                        "type": "string"
                      },
                      "parameters": {
                        "description": "Dictionary of parameters and their values",
                        "patternProperties": {
                          "^.*$": {
                            "oneOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "type": "object"
                      },
                      "type": {
                        "description": "Database object type",
                        "enum": [
                          "table",
                          "view",
                          "stored-procedure"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "type",
                      "object"
                    ],
                    "type": "object"
                  }
                ]
              }
            },
            "required": [
              "source",
              "permissions"
            ],
            "then": {
              "properties": {
                "permissions": {
                  "description": "Permissions assigned to this object",
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "actions": {
                        "oneOf": [
                          {
                            "pattern": "[*]",
                            "type": "string"
                          },
                          {
                            "items": {
                              "oneOf": [
                                {
                                  "$ref": "#/$defs/action"
                                },
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "action": {
                                      "$ref": "#/$defs/action"
                                    },
                                    "fields": {
                                      "additionalProperties": false,
                                      "properties": {
                                        "exclude": {
                                          "items": {
                                            "type": "string"
                                          },
                                          "type": "array"
                                        },
                                        "include": {
                                          "items": {
                                            "type": "string"
                                          },
                                          "type": "array"
                                        }
                                      },
                                      "type": "object"
                                    },
                                    "policy": {
                                      "additionalProperties": false,
                                      "description": "Define item-level security policy",
                                      "properties": {
                                        "database": {
                                          "type": "string"
                                        }
                                      },
                                      "type": "object"
                                    }
                                  },
                                  "type": "object"
                                }
                              ]
                            },
                            "type": "array",
                            "uniqueItems": true
                          }
                        ]
                      },
                      "role": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "required": [
                    "role",
                    "actions"
                  ],
                  "type": "array"
                }
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "runtime": {
        "additionalProperties": false,
        "description": "Runtime configuration settings",
        "properties": {
          "cache": {
            "additionalProperties": false,
            "properties": {
              "enabled": {
                "default": false,
                "description": "Enable caching of responses globally.",
                "type": "boolean"
              },
              "ttl-seconds": {
                "default": 5,
                "description": "Time to live in seconds",
                "type": "integer"
              }
            },
            "type": "object"
          },
          "graphql": {
            "additionalProperties": false,
            "description": "Global GraphQL endpoint configuration",
            "properties": {
              "allow-introspection": {
                "description": "Allow querying of the underlying GraphQL schema.",
                "type": "boolean"
              },
              "enabled": {
                "description": "Allow enabling/disabling GraphQL requests for all entities.",
                "type": "boolean"
              },
              "multiple-mutations": {
                "additionalProperties": false,
                "description": "Configuration properties for multiple mutation operations",
                "properties": {
                  "create": {
                    "additionalProperties": false,
                    "description": "Options for multiple create operations",
                    "properties": {
                      "enabled": {
                        "default": false,
                        "description": "Allow enabling/disabling multiple create operations for all entities.",
                        "type": "boolean"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "path": {
                "default": "/graphql",
                "type": "string"
              }
            },
            "type": "object"
          },
          "host": {
            "additionalProperties": false,
            "description": "Global hosting configuration",
            "properties": {
              "authentication": {
                "additionalProperties": false,
                "properties": {
                  "jwt": {
                    "additionalProperties": false,
                    "properties": {
                      "audience": {
                        "type": "string"
                      },
                      "issuer": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "provider": {
                    "default": "StaticWebApps",
                    "description": "The name of authentication provider",
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "cors": {
                "additionalProperties": false,
                "description": "Configure CORS",
                "properties": {
                  "allow-credentials": {
                    "default": "false",
                    "description": "Set value for Access-Control-Allow-Credentials header",
                    "type": "boolean"
                  },
                  "origins": {
                    "default": [],
                    "description": "Allowed origins",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "mode": {
                "default": "production",
                "description": "Set if running in Development or Production mode",
                "enum": [
                  "production",
                  "development"
                ],
                "type": "string"
              }
            },
            "type": "object"
          },
          "rest": {
            "additionalProperties": false,
            "description": "Global REST endpoint configuration",
            "properties": {
              "enabled": {
                "description": "Allow enabling/disabling REST requests for all entities.",
                "type": "boolean"
              },
              "path": {
                "default": "/api",
                "type": "string"
              },
              "request-body-strict": {
                "default": true,
                "description": "Does not allow extraneous fields in request body when set to true.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "telemetry": {
            "additionalProperties": false,
            "description": "Telemetry configuration",
            "properties": {
              "application-insights": {
                "additionalProperties": false,
                "properties": {
                  "connection-string": {
                    "description": "Application Insights connection string",
                    "type": "string"
                  },
                  "enabled": {
                    "default": true,
                    "description": "Allow enabling/disabling Application Insights telemetry.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "connection-string"
                ],
                "type": "object"
              }
            },
            "required": [
              "application-insights"
            ],
            "type": "object"
          }
        },
        "type": "object"
      }
    },
    "required": [
      "data-source",
      "entities"
    ],
    "title": "Data API builder",
    "type": "object"
  }