Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Why make this change?

The data-source.health.name property exists in the DAB schema but was not exposed as a CLI parameter, making it impossible to configure via command line.

What is this change?

Added --data-source.health.name CLI parameter to the dab configure command.

Implementation details:

  • Added DataSourceHealthName parameter to ConfigureOptions with CLI option binding
  • Extended TryUpdateConfiguredDataSourceOptions to create or update health configuration while preserving existing settings
  • Modified DatasourceHealthOptionsConvertorFactory.Write() to serialize health object when name is set (previously only serialized when enabled was explicitly provided)

How was this tested?

  • Unit Tests
    • TestAddDataSourceHealthName - validates adding name to config without health section
    • TestUpdateDataSourceHealthName - validates updating name while preserving existing health settings

Sample Request(s)

CLI usage:

# Add health name to a new or existing config
dab configure --data-source.health.name "Production SQL Server" -c dab-config.json

Result:

{
  "data-source": {
    "database-type": "mssql",
    "connection-string": "@env('MSSQL_CONNECTION_STRING')",
    "health": {
      "enabled": true,
      "name": "Production SQL Server"
    }
  }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: dab configure --data-source.health.name is missing.</issue_title>
<issue_description>### What happened?

The data-source.health.name property exists in the DAB schema but isn't exposed as a CLI parameter

Target configuration:

{
  "$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.7.81/dab.draft.schema.json",
  "data-source": {
    "database-type": "mssql",
    "connection-string": "@env('MSSQL_CONNECTION_STRING')",
    "health": {
      "name": "This is the value" // here
    }
  }
}

Version

Microsoft.DataApiBuilder 1.7.81

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

No response

Relevant log output

> dab configure --data-source.health.name my data source -c "dab-config-4.json"

Microsoft.DataApiBuilder 1.7.81-rc+c7927fa9885160ed35bcc9b25b13fd59b88f3133
c Microsoft Corporation. All rights reserved.

ERROR(S):
  Option 'data-source.health.name' is unknown.

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 14, 2026 04:57
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI parameter for data-source.health.name Add CLI parameter for data-source.health.name Jan 14, 2026
Copilot AI requested a review from JerryNixon January 14, 2026 05:21
@JerryNixon JerryNixon assigned Aniruddh25 and Copilot and unassigned Copilot Jan 15, 2026
@JerryNixon JerryNixon marked this pull request as ready for review January 21, 2026 21:40
Copilot AI review requested due to automatic review settings January 21, 2026 21:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Exposes the existing data-source.health.name config property as a dab configure CLI option and ensures it round-trips correctly through config serialization.

Changes:

  • Added --data-source.health.name option to ConfigureOptions.
  • Updated TryUpdateConfiguredDataSourceOptions to create/update DataSource.Health.Name.
  • Updated datasource health JSON converter to serialize the health object when name (or threshold) is set, plus added unit tests for add/update scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Cli/Commands/ConfigureOptions.cs Adds CLI option binding for data-source.health.name.
src/Cli/ConfigGenerator.cs Applies the new option to runtime config by creating/updating datasource health config.
src/Config/Converters/DatasourceHealthOptionsConvertorFactory.cs Ensures health is written when name is present (and when threshold was user-provided).
src/Cli.Tests/ConfigureOptionsTests.cs Adds tests for adding/updating datasource health name while preserving existing health settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Preserve threshold only if it was explicitly set by the user
int? thresholdToPreserve = datasourceHealthCheckConfig.UserProvidedThresholdMs ? datasourceHealthCheckConfig.ThresholdMs : null;
datasourceHealthCheckConfig = new DatasourceHealthCheckConfig(
enabled: datasourceHealthCheckConfig.Enabled,
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When updating an existing DatasourceHealthCheckConfig, passing enabled: datasourceHealthCheckConfig.Enabled will always set UserProvidedEnabled = true (because the constructor treats non-null enabled as user-provided). If the existing config omitted health.enabled (defaulting to true), updating the name will now write enabled: true and permanently mark it as user-provided. To truly preserve existing settings, pass enabled: datasourceHealthCheckConfig.UserProvidedEnabled ? datasourceHealthCheckConfig.Enabled : null (or otherwise carry forward the original UserProvidedEnabled state).

Suggested change
enabled: datasourceHealthCheckConfig.Enabled,
enabled: datasourceHealthCheckConfig.UserProvidedEnabled ? datasourceHealthCheckConfig.Enabled : null,

Copilot uses AI. Check for mistakes.
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.

[Bug]: dab configure --data-source.health.name is missing.

3 participants