Skip to content

feat: Added connection references validator #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tompivny
Copy link

Connection references validation

This pull request introduces a new build task called ValidateConnectionReferences

Features

  1. Exctracts defined connection references from Customizations.xml
  2. Checks logical names of the connection references used in flows' JSON definitions
  3. Provides error messages for any mismatches

Usage

To call the target in a solution with Power Automate flows:

<Target Name="BuildDataverseSolution" BeforeTargets="Build" Condition="Exists('$(ProjectDir)$(SolutionRootPath)\Other\Solution.xml')">
    <CallTarget Targets="ValidateConnectionReferences"/>
    <!--Other build targets-->
</Target>

Optionally, if the connection references are defined in a different solution, you can use a custom property ConnectionReferencesSolutionPath.

For example:

<PropertyGroup>
    <SolutionRootPath>Declarations</SolutionRootPath>
    <ConnectionReferencesSolutionPath>../ConnectionReferenceSolution/$(SolutionRootPath)</ConnectionReferencesSolutionPath>
</PropertyGroup>

@TomProkop
Copy link
Member

Thank you for the contribution!

I've got only one small suggestion.

We locate the solution files and load them as MSBuild Items here:

<Flows Include="$(DataverseSolutionSourceFolderFullPath)\Workflows\*.json"/>

Then we pass the Items to a .NET task like this:
https://github.com/TALXIS/tools-devkit-build/blob/a92259d0705f03689a05f6582d3e134614882744/src/Dataverse/MSBuildTasks/Targets/ValidateSolutionComponentSchema.targets#L8C9-L8C92

It would be nice to do it the same way. We'll need to migrate to a new structure next year once Microsoft releases new source control format for solutions.

If you don't have time for that, I'll look at it later.

@tompivny
Copy link
Author

Thank you for the contribution!

I've got only one small suggestion.

We locate the solution files and load them as MSBuild Items here:

<Flows Include="$(DataverseSolutionSourceFolderFullPath)\Workflows\*.json"/>

Then we pass the Items to a .NET task like this: https://github.com/TALXIS/tools-devkit-build/blob/a92259d0705f03689a05f6582d3e134614882744/src/Dataverse/MSBuildTasks/Targets/ValidateSolutionComponentSchema.targets#L8C9-L8C92

It would be nice to do it the same way. We'll need to migrate to a new structure next year once Microsoft releases new source control format for solutions.

If you don't have time for that, I'll look at it later.

Got it. I tried to implement your suggestion

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.

2 participants