Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
786 stars 142 forks source link

Fix `dab validate` env_var parsing. #2215

Closed seantleonard closed 1 month ago

seantleonard commented 1 month ago

Why make this change?

What is this change?

How was this tested?

Sample Request(s)

Add the file launchSettings.json to src/Cli/Properties with the following contents:

{
  "profiles": {
    "start": {
      "commandName": "Project",
      "commandLineArgs": "start -c src\\Cli\\dab-config.json",
      "environmentVariables": {
        "DATABASE_TYPE": "mssql",
        "DATABASE_NAME": "<your DB name",
        "CONN_STRING": "<CONN_STRING>",
        "AUTH_METHOD": "Simulator",
        "PUB_ENT_SRC": "publishers"
      },
      "httpPort": 5002
    },
    "validate": {
      "commandName": "Project",
      "commandLineArgs": "validate -c src\\Cli\\dab-config.json",
      "environmentVariables": {
        "DATABASE_TYPE": "mssql",
        "DATABASE_NAME": "<your DB name>",
        "CONN_STRING": "<CONN_STRING>",
        "AUTH_METHOD": "Simulator",
        "PUB_ENT_SRC": "publishers"
      },
      "httpPort": 5002
    }
  }
}

and modify your dab-config.json to have the following contents (assumes that you've deployed the DAB test project's .sql script:

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v0.13.0-rc/dab.draft.schema.json",
  "data-source": {
    "database-type": "@env('DATABASE_TYPE')",
    "connection-string": "@env('CONN_STRING')"
  },
  "runtime": {
    "rest": {
      "enabled": true,
      "path": "/api"
    },
    "graphql": {
      "allow-introspection": true,
      "enabled": true,
      "path": "/graphql"
    },
    "host": {
      "mode": "development",
      "cors": {
        "origins": [
          "http://localhost:5000"
        ],
        "allow-credentials": false
      },
      "authentication": {
        "provider": "@env('AUTH_METHOD')"
      }
    }
  },
  "entities": {
    "Query": {
      "source": "books",
      "permissions": [
        {
          "role": "anonymous",
          "actions": [
            "read"
          ]
        }
      ],
      "graphql": {
        "type": {
          "singular": "ProductCatalogue",
          "plural": "ProductCatalogue"
        }
      }
    },
    "Product": {
      "source": "@env('PUB_ENT_SRC')",
      "permissions": [
        {
          "role": "authenticated",
          "actions": [
            "read",
            "delete",
            "update"
          ]
        }
      ]
    }
  }
}
seantleonard commented 1 month ago

/azp run

Aniruddh25 commented 1 month ago

/azp run

seantleonard commented 1 month ago

/azp run