Skip to content

Conversation

SteveL-MSFT
Copy link
Member

PR Summary

For copy, the count property was explicitly set in the schema as an int so you can't use an expression. This change adds a new num IntOrExpression and during copy we parse and execute the expression.

Additionally, for parameters() we explicitly check the result matches the defined parameter type rather than having it get validated and fail later.

PR Context

Part of #1177

@SteveL-MSFT SteveL-MSFT requested review from Copilot and tgauth October 20, 2025 22:30
Copy link
Contributor

@Copilot 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

This PR enables the copy.count property to accept expressions in addition to integer literals, addressing part of issue #1177. The implementation introduces an IntOrExpression enum type that can parse and evaluate expressions at runtime, and adds validation to ensure parameters() function results match their declared types.

Key changes:

  • Introduced IntOrExpression enum to support both literal integers and string expressions for copy.count and copy.batch_size
  • Enhanced parameters() function with type validation for all data types (String, Int, Bool, Object, Array)
  • Added expression evaluation logic in the copy loop to resolve dynamic count values

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/dsc-lib/src/configure/config_doc.rs Defines new IntOrExpression enum and updates Copy struct to use it for count and batch_size fields
lib/dsc-lib/src/configure/mod.rs Implements expression parsing and evaluation for copy count, converting expressions to i64 at runtime
lib/dsc-lib/src/functions/parameters.rs Adds explicit type checking for all parameter types to validate results match declared types
lib/dsc-lib/locales/en-us.toml Adds localized error messages for type validation failures
dsc/tests/dsc_copy.tests.ps1 Adds test case verifying copy count can accept expressions like parameters('serverCount')

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

1 participant