Skip to content

Conversation

ayush3797
Copy link
Contributor

@ayush3797 ayush3797 commented May 14, 2024

Why make this change?

Ports bug-fixes to release/1.1:

1.) #2214
2.) #2215
3.) #2208
4.) #2216

yogivk and others added 3 commits May 14, 2024 09:22
## Why make this change?
Closes #1635 

## What is this change?

Checking if Application Name is already present in the PgSql connection
string. I f yes, we append DAB APP NAME with ',' as separator else, we
add an Application Name property to connection string.

## How was this tested?

- [ ] Unit Tests

## Sample Request(s)

If Application Name is specified by the developer, then DAB will append
to it, else will add Application Name property

---------

Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
## Why make this change?

- Closes #2206
- As noted in #2207, now that false positive vulnerability alert no
longer shows due to correct patched versions being recognized by dotnet
restore.
- Merging Directory to 1.1 branch.

## What is this change?

- For .net6 updates npgsql to 7.0.7.
- Removes "ignore" tag on serialization/deserialization test that broke
because of the npgsql version used.

## How was this tested?
- [x] Unit Tests 
- `dotnet format` step passes without dotnet restore vulnerability
alert.
- unit test `TestDictionaryDatabaseObjectSerializationDeserialization`
unignored
## Why make this change?

- Closes #2200, an issue with `dab validate -c "path_to_config.json"`
where environment variable `@env('ENV_VAR_NAME')` references are
unresolved during config schema validation and schema validation always
fails. The issue specifically calls out an error when an environment
variable is used for the property `database-type` can't resolve an
environment variable and properly set an enum value (mssql, pgsql,
mysql, etc) for the property.

## What is this change?

- This change corrects how
`RuntimeConfigValidator::ValidateConfigSchema(...)` resolves environment
variables in the runtime config. The usage of `string jsonData =
runtimeConfig.ToJson();` converts the runtime config object (which
already has environment variables resolved) into valid json which can
then be validated against `dab.draft.schema.json`.

## How was this tested?

- [x] Integration Tests: added a test which exercises the code path that
validates the dab runtime config against the dab json schema. By
ensuring that no schema validation errors occur due to unresolved
environment variables.

## Sample Request(s)

Add the file `launchSettings.json` to `src/Cli/Properties` with the
following contents:
```json
{
  "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:

```json
{
  "$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"
          ]
        }
      ]
    }
  }
}
```
@ayush3797
Copy link
Contributor Author

/azp run

@ayush3797 ayush3797 changed the title [Cherry-pick] Bug fixes to release 1.1 [Cherry-pick] Bug fixes/Upgrades/Enhancements to release 1.1 May 14, 2024
Updated Support.md for GA
@ayush3797
Copy link
Contributor Author

/azp run

@ayush3797 ayush3797 enabled auto-merge (squash) May 14, 2024 04:25
@ayush3797 ayush3797 merged commit 74ea6c5 into release/1.1 May 14, 2024
@ayush3797 ayush3797 deleted the release1.1/cherryPick branch May 14, 2024 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants