diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 7f699ec4..94d6b357 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -46,17 +46,6 @@ jobs:
- name: Test - PAModel
run: dotnet bin/Debug/PAModelTests/PAModelTests.dll
- - name: Test - YamlValidator
- run: dotnet bin/Debug/YamlValidator.Tests/YamlValidator.Tests.dll
-
- - name: Test - Persistence.Tests Yaml Files (ubuntu & macos)
- run: ./scripts/PersistenceValidate.sh
- if: ${{ runner.os != 'Windows' }}
-
- - name: Test - Persistence.Tests Yaml Files (windows)
- run: ./scripts/PersistenceValidate.ps1
- if: ${{ runner.os == 'Windows' }}
-
- name: Restore workloads for samples
run: dotnet workload restore samples/MauiMsApp/MauiMsApp.csproj
diff --git a/scripts/PersistenceValidate.ps1 b/scripts/PersistenceValidate.ps1
deleted file mode 100644
index 2edf3ff8..00000000
--- a/scripts/PersistenceValidate.ps1
+++ /dev/null
@@ -1,23 +0,0 @@
-<#
- Validate's the Yaml Controls used by Persistence's Unit Tests
- Uses the repository's root as entry point (similar to how containers on github actions would)
-#>
-
-$AppTestDir = "..\Persistence.Tests\_TestData\AppsWithYaml"
-$ControlTestDir = "..\Persistence.Tests\_TestData\ValidYaml-CI"
-
-# come back to same directory after validation
-Push-Location
-
-Set-Location -Path "bin\Debug\YamlValidator"
-
-$AppTestResults = dotnet YamlValidator.dll validate --path $AppTestDir
-Write-Output "Validating Directory $AppTestDir `n"
-$AppTestResults
-
-$ControlTestResults = dotnet YamlValidator.dll validate --path $ControlTestDir
-Write-Output "Validating Directory $ControlTestDir `n"
-$ControlTestResults
-
-# restore location
-Pop-Location
diff --git a/scripts/PersistenceValidate.sh b/scripts/PersistenceValidate.sh
deleted file mode 100755
index 8d8794e4..00000000
--- a/scripts/PersistenceValidate.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# This script is used to validate whether persistence has valid tests
-
-cd bin/Debug/YamlValidator
-
-APP_TEST_DIR="../Persistence.Tests/_TestData/AppsWithYaml"
-CONTROL_TEST_DIR="../Persistence.Tests/_TestData/ValidYaml-CI"
-
-app_test_results=$(dotnet YamlValidator.dll validate --path $APP_TEST_DIR)
-printf "Validating Directory $APP_TEST_DIR \n"
-printf "$app_test_results"
-
-control_test_results=$(dotnet YamlValidator.dll validate --path $CONTROL_TEST_DIR)
-printf "Validating Directory $CONTROL_TEST_DIR \n"
-printf "$control_test_results"
diff --git a/src/PASopa.sln b/src/PASopa.sln
index f16b903d..a7347547 100644
--- a/src/PASopa.sln
+++ b/src/PASopa.sln
@@ -20,10 +20,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerPlatform.Pow
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistence.Tests", "Persistence.Tests\Persistence.Tests.csproj", "{8AB1C901-FE5E-44BF-AA21-B8F20A9D7CDD}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YamlValidator", "YamlValidator\YamlValidator.csproj", "{F0AD11CE-E634-4945-A6B1-7866CDE0059C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YamlValidator.Tests", "YamlValidator.Tests\YamlValidator.Tests.csproj", "{8BA5DD4B-9423-4827-AF37-540E0300DB9A}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7361DB16-D534-4E0E-8597-BE22317DEF47}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
@@ -56,14 +52,6 @@ Global
{8AB1C901-FE5E-44BF-AA21-B8F20A9D7CDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AB1C901-FE5E-44BF-AA21-B8F20A9D7CDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AB1C901-FE5E-44BF-AA21-B8F20A9D7CDD}.Release|Any CPU.Build.0 = Release|Any CPU
- {F0AD11CE-E634-4945-A6B1-7866CDE0059C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F0AD11CE-E634-4945-A6B1-7866CDE0059C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F0AD11CE-E634-4945-A6B1-7866CDE0059C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F0AD11CE-E634-4945-A6B1-7866CDE0059C}.Release|Any CPU.Build.0 = Release|Any CPU
- {8BA5DD4B-9423-4827-AF37-540E0300DB9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8BA5DD4B-9423-4827-AF37-540E0300DB9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8BA5DD4B-9423-4827-AF37-540E0300DB9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8BA5DD4B-9423-4827-AF37-540E0300DB9A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -71,7 +59,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{8AD94CC0-7330-4880-A8E0-177B37CDB27B} = {4993E606-484B-46D9-892E-7AE9CE8D4423}
{8AB1C901-FE5E-44BF-AA21-B8F20A9D7CDD} = {4993E606-484B-46D9-892E-7AE9CE8D4423}
- {8BA5DD4B-9423-4827-AF37-540E0300DB9A} = {4993E606-484B-46D9-892E-7AE9CE8D4423}
{7361DB16-D534-4E0E-8597-BE22317DEF47} = {794D8C68-BF6F-49C8-BCA5-AA52D8F45EF4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
diff --git a/src/Persistence.Tests/Persistence.Tests.csproj b/src/Persistence.Tests/Persistence.Tests.csproj
index b782c3ba..215bc194 100644
--- a/src/Persistence.Tests/Persistence.Tests.csproj
+++ b/src/Persistence.Tests/Persistence.Tests.csproj
@@ -18,6 +18,7 @@
PreserveNewest
+
PreserveNewest
diff --git a/src/YamlValidator.Tests/ValidatorTest.cs b/src/Persistence.Tests/YamlValidator/ValidatorTest.cs
similarity index 92%
rename from src/YamlValidator.Tests/ValidatorTest.cs
rename to src/Persistence.Tests/YamlValidator/ValidatorTest.cs
index e236964f..20030b95 100644
--- a/src/YamlValidator.Tests/ValidatorTest.cs
+++ b/src/Persistence.Tests/YamlValidator/ValidatorTest.cs
@@ -10,10 +10,10 @@ namespace Persistence.Tests.YamlValidator;
public class ValidatorTest
{
- private static readonly string _validPath = Path.Combine(".", "_TestData", "ValidYaml") +
+ private static readonly string _validPath = Path.Combine(".", "_TestData", "ValidatorTests", "ValidYaml") +
Path.DirectorySeparatorChar;
- private static readonly string _invalidPath = Path.Combine(".", "_TestData", "InvalidYaml") +
+ private static readonly string _invalidPath = Path.Combine(".", "_TestData", "ValidatorTests", "InvalidYaml") +
Path.DirectorySeparatorChar;
private readonly JsonSchema _schema;
@@ -22,7 +22,7 @@ public class ValidatorTest
public ValidatorTest()
{
var schemaFileLoader = new SchemaLoader();
- _schema = schemaFileLoader.Load(Constants.DefaultSchemaPath);
+ _schema = schemaFileLoader.Load();
var resultVerbosity = new VerbosityData(Constants.Verbose);
_yamlValidator = new Validator(resultVerbosity.EvalOptions, resultVerbosity.JsonOutputOptions);
}
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/ControlWithInvalidProperty.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ControlWithInvalidProperty.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/ControlWithInvalidProperty.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ControlWithInvalidProperty.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/Empty.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/Empty.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/Empty.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/Empty.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/EmptyArray.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/EmptyArray.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/EmptyArray.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/EmptyArray.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/NamelessObjectNoControl.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/NamelessObjectNoControl.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/NamelessObjectNoControl.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/NamelessObjectNoControl.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithNameNoColon.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithNameNoColon.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithNameNoColon.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithNameNoColon.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithNameNoValue.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithNameNoValue.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithNameNoValue.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithNameNoValue.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithoutControlProperty.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithoutControlProperty.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/ScreenWithoutControlProperty.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/ScreenWithoutControlProperty.yaml
diff --git a/src/YamlValidator.Tests/_TestData/InvalidYaml/WrongControlDefinition.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/WrongControlDefinition.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/InvalidYaml/WrongControlDefinition.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/InvalidYaml/WrongControlDefinition.yaml
diff --git a/src/YamlValidator.Tests/_TestData/ValidYaml/NamelessObjectWithControl.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/NamelessObjectWithControl.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/ValidYaml/NamelessObjectWithControl.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/NamelessObjectWithControl.yaml
diff --git a/src/YamlValidator.Tests/_TestData/ValidYaml/SimpleNoRecursiveDefinition.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/SimpleNoRecursiveDefinition.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/ValidYaml/SimpleNoRecursiveDefinition.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/SimpleNoRecursiveDefinition.yaml
diff --git a/src/YamlValidator.Tests/_TestData/ValidYaml/ValidScreen1.yaml b/src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/ValidScreen1.yaml
similarity index 100%
rename from src/YamlValidator.Tests/_TestData/ValidYaml/ValidScreen1.yaml
rename to src/Persistence.Tests/_TestData/ValidatorTests/ValidYaml/ValidScreen1.yaml
diff --git a/src/Persistence/Microsoft.PowerPlatform.PowerApps.Persistence.csproj b/src/Persistence/Microsoft.PowerPlatform.PowerApps.Persistence.csproj
index 7dd196a8..7f978dd4 100644
--- a/src/Persistence/Microsoft.PowerPlatform.PowerApps.Persistence.csproj
+++ b/src/Persistence/Microsoft.PowerPlatform.PowerApps.Persistence.csproj
@@ -32,7 +32,7 @@
true
true
- $(NoWarn);NU1601
+ $(NoWarn);NU1601;CA1822
@@ -43,6 +43,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/YamlValidator/Constants.cs b/src/Persistence/YamlValidator/Constants.cs
similarity index 100%
rename from src/YamlValidator/Constants.cs
rename to src/Persistence/YamlValidator/Constants.cs
diff --git a/src/YamlValidator/SchemaLoader.cs b/src/Persistence/YamlValidator/SchemaLoader.cs
similarity index 70%
rename from src/YamlValidator/SchemaLoader.cs
rename to src/Persistence/YamlValidator/SchemaLoader.cs
index 05e93e21..48e65628 100644
--- a/src/YamlValidator/SchemaLoader.cs
+++ b/src/Persistence/YamlValidator/SchemaLoader.cs
@@ -8,11 +8,12 @@ namespace Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator;
public class SchemaLoader
{
private const string _schemaFolderPath = "subschemas";
+ private static readonly string _schemaPath = Path.Combine(".", "YamlValidator", "schema", "pa.yaml-schema.json");
- public JsonSchema Load(string schemaPath)
+ public JsonSchema Load()
{
- var node = JsonSchema.FromFile(schemaPath);
- var schemaFolder = Path.GetDirectoryName(schemaPath);
+ var node = JsonSchema.FromFile(_schemaPath);
+ var schemaFolder = Path.GetDirectoryName(_schemaPath);
var subschemaPaths = Directory.GetFiles($@"{schemaFolder}{Path.DirectorySeparatorChar}{_schemaFolderPath}",
$"*{Constants.JsonFileExtension}");
diff --git a/src/YamlValidator/Utility.cs b/src/Persistence/YamlValidator/Utility.cs
similarity index 100%
rename from src/YamlValidator/Utility.cs
rename to src/Persistence/YamlValidator/Utility.cs
diff --git a/src/YamlValidator/Orchestrator.cs b/src/Persistence/YamlValidator/ValidationProcessor.cs
similarity index 82%
rename from src/YamlValidator/Orchestrator.cs
rename to src/Persistence/YamlValidator/ValidationProcessor.cs
index 5c889020..85f173c2 100644
--- a/src/YamlValidator/Orchestrator.cs
+++ b/src/Persistence/YamlValidator/ValidationProcessor.cs
@@ -3,13 +3,13 @@
namespace Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator;
-public class Orchestrator
+public class ValidationProcessor
{
private readonly YamlLoader _fileLoader;
private readonly SchemaLoader _schemaLoader;
private readonly Validator _validator;
- public Orchestrator(YamlLoader fileLoader, SchemaLoader schemaLoader, Validator validator)
+ public ValidationProcessor(YamlLoader fileLoader, SchemaLoader schemaLoader, Validator validator)
{
_fileLoader = fileLoader;
_schemaLoader = schemaLoader;
@@ -18,12 +18,11 @@ public Orchestrator(YamlLoader fileLoader, SchemaLoader schemaLoader, Validator
public void RunValidation(ValidationRequest inputData)
{
- var schemaPath = inputData.SchemaPath;
var path = inputData.FilePath;
var pathType = inputData.FilePathType;
var yamlData = _fileLoader.Load(path, pathType);
- var serializedSchema = _schemaLoader.Load(schemaPath);
+ var serializedSchema = _schemaLoader.Load();
foreach (var yamlFileData in yamlData)
{
diff --git a/src/YamlValidator/ValidationRequest.cs b/src/Persistence/YamlValidator/ValidationRequest.cs
similarity index 83%
rename from src/YamlValidator/ValidationRequest.cs
rename to src/Persistence/YamlValidator/ValidationRequest.cs
index 55bb8b6a..568b16d8 100644
--- a/src/YamlValidator/ValidationRequest.cs
+++ b/src/Persistence/YamlValidator/ValidationRequest.cs
@@ -3,4 +3,4 @@
namespace Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator;
-public readonly record struct ValidationRequest(string FilePath, string SchemaPath, string FilePathType);
+public readonly record struct ValidationRequest(string FilePath, string FilePathType);
diff --git a/src/YamlValidator/Validator.cs b/src/Persistence/YamlValidator/Validator.cs
similarity index 100%
rename from src/YamlValidator/Validator.cs
rename to src/Persistence/YamlValidator/Validator.cs
diff --git a/src/YamlValidator/ValidatorError.cs b/src/Persistence/YamlValidator/ValidatorError.cs
similarity index 100%
rename from src/YamlValidator/ValidatorError.cs
rename to src/Persistence/YamlValidator/ValidatorError.cs
diff --git a/src/YamlValidator/ValidatorResults.cs b/src/Persistence/YamlValidator/ValidatorResults.cs
similarity index 100%
rename from src/YamlValidator/ValidatorResults.cs
rename to src/Persistence/YamlValidator/ValidatorResults.cs
diff --git a/src/YamlValidator/VerbosityData.cs b/src/Persistence/YamlValidator/VerbosityData.cs
similarity index 100%
rename from src/YamlValidator/VerbosityData.cs
rename to src/Persistence/YamlValidator/VerbosityData.cs
diff --git a/src/YamlValidator/YamlLoader.cs b/src/Persistence/YamlValidator/YamlLoader.cs
similarity index 100%
rename from src/YamlValidator/YamlLoader.cs
rename to src/Persistence/YamlValidator/YamlLoader.cs
diff --git a/src/Persistence/packages.lock.json b/src/Persistence/packages.lock.json
index 80d0be12..31e5de72 100644
--- a/src/Persistence/packages.lock.json
+++ b/src/Persistence/packages.lock.json
@@ -2,6 +2,15 @@
"version": 1,
"dependencies": {
"net8.0": {
+ "JsonSchema.Net": {
+ "type": "Direct",
+ "requested": "[7.1.0, )",
+ "resolved": "7.1.0",
+ "contentHash": "4DmCZQdVLNolzghMVK1oO49jZpvx7wVCP3OQEzxU5GK/OEhHcg+CAiAR8P/z69PT7STEIlguxb35nkFndZl2WA==",
+ "dependencies": {
+ "JsonPointer.Net": "5.0.0"
+ }
+ },
"Microsoft.Extensions.Logging": {
"type": "Direct",
"requested": "[8.0.0, )",
@@ -30,12 +39,40 @@
"System.Collections.Immutable": "6.0.0"
}
},
+ "Yaml2JsonNode": {
+ "type": "Direct",
+ "requested": "[2.1.0, )",
+ "resolved": "2.1.0",
+ "contentHash": "7rjrWyPVZGnd/udlNDAZWg24+4LMltQq1CJLKpoGA1Ee8YVVtqoqAWfdB2U0KhkkdBijPd694VIfdACvSLX9/A==",
+ "dependencies": {
+ "YamlDotNet": "15.1.2"
+ }
+ },
"YamlDotNet": {
"type": "Direct",
"requested": "[15.1.6, )",
"resolved": "15.1.6",
"contentHash": "T/cQEK/KHK96Q8kytJ4iUGDXg1/fj2Qtk6rCQeIlHYU1zTeyGVHW0QNZgREQyxZpygGMDMmrXNWt0sj5TsQnjA=="
},
+ "Humanizer.Core": {
+ "type": "Transitive",
+ "resolved": "2.14.1",
+ "contentHash": "lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw=="
+ },
+ "Json.More.Net": {
+ "type": "Transitive",
+ "resolved": "2.0.1.2",
+ "contentHash": "uF3QeiaXEfH92emz0/BWUiNtMSfxIIvgynuB0Bf1vF4s8eWTcZitBx9l+g/FDaJk5XxqBv9buQXizXKQcXFG1w=="
+ },
+ "JsonPointer.Net": {
+ "type": "Transitive",
+ "resolved": "5.0.0",
+ "contentHash": "fm4T5w20AY6C+p5/pJr0vrXRNGgtSfHl34I1LxC9zdPwS9S3j0GiR1Mz/CVPWKDXXGDpCt1APHpCq7kn5adCfA==",
+ "dependencies": {
+ "Humanizer.Core": "2.14.1",
+ "Json.More.Net": "2.0.1.2"
+ }
+ },
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "6.0.0",
diff --git a/src/YamlValidator.Tests/YamlValidator.Tests.csproj b/src/YamlValidator.Tests/YamlValidator.Tests.csproj
deleted file mode 100644
index e7f23ef3..00000000
--- a/src/YamlValidator.Tests/YamlValidator.Tests.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- net8.0
- enable
- enable
- true
- Exe
- false
- true
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/YamlValidator/InputProcessor.cs b/src/YamlValidator/InputProcessor.cs
deleted file mode 100644
index 2045643f..00000000
--- a/src/YamlValidator/InputProcessor.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.CommandLine;
-
-namespace Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator;
-
-public class InputProcessor
-{
- private static void ProcessFiles(string path, string schema, string pathType)
- {
- // read only records
- var filePathInfo = new ValidationRequest(path, schema, pathType);
- var verbosityInfo = new VerbosityData(Constants.Verbose);
-
- var validator = new Validator(verbosityInfo.EvalOptions, verbosityInfo.JsonOutputOptions);
- var schemaLoader = new SchemaLoader();
- var fileLoader = new YamlLoader();
- var orchestrator = new Orchestrator(fileLoader, schemaLoader, validator);
- orchestrator.RunValidation(filePathInfo);
- }
-
- public static RootCommand GetRootCommand()
- {
-
- var pathOption = new Option(
- name: "--path",
- description: "The path to the input yaml file or directory of yaml files"
- )
- { IsRequired = true };
-
- pathOption.AddValidator(result =>
- {
- var inputFilePath = result.GetValueForOption(pathOption);
-
- // either file or folder must be passed
- if (string.IsNullOrWhiteSpace(inputFilePath))
- {
- result.ErrorMessage = "The input is invalid, input must be a filepath to a yaml file \\" +
- "or a folder path to a folder of yaml files";
- }
- else if (!Directory.Exists(inputFilePath) && !File.Exists(inputFilePath))
- {
- result.ErrorMessage = $"The path '{inputFilePath}' does not exist";
- }
- else if (File.Exists(inputFilePath))
- {
- if (!inputFilePath.EndsWith(Constants.YamlFileExtension, StringComparison.OrdinalIgnoreCase))
- {
- result.ErrorMessage = $"The file '{inputFilePath}' must be a '{Constants.YamlFileExtension}' file";
- }
- }
- });
-
- // assume local schema file exists in NuGet package, use relative filepath for now
- var schemaOption = new Option(
- name: "--schema",
- description: "The path to the schema json file",
- getDefaultValue: () => Constants.DefaultSchemaPath
- );
-
- schemaOption.AddValidator(result =>
- {
- var schemaPath = result.GetValueForOption(schemaOption);
- if (string.IsNullOrEmpty(schemaPath))
- {
- result.ErrorMessage = "Schema option selected, but no schema was provided";
- }
- else if (Path.GetExtension(schemaPath) != Constants.JsonFileExtension)
- {
- result.ErrorMessage = "The schema file must be a json file";
- }
- else if (!File.Exists(schemaPath))
- {
- result.ErrorMessage = $"The schema file '{schemaPath}' does not exist";
- }
- });
-
- // define root
- var rootCommand = new RootCommand("Power Apps YAML validator command line tool");
-
- // validate command
- var validateCommand = new Command("validate", "Validate the input Power Apps YAML file")
- {
- pathOption,
- schemaOption
- };
-
- validateCommand.SetHandler((pathOptionVal, schemaOptionVal) =>
- {
- var pathType = File.GetAttributes(pathOptionVal).HasFlag(FileAttributes.Directory) ? Constants.FolderTypeName :
- Constants.FileTypeName;
- ProcessFiles(pathOptionVal, schemaOptionVal, pathType);
-
- }, pathOption, schemaOption);
-
- rootCommand.AddCommand(validateCommand);
-
- return rootCommand;
- }
-}
diff --git a/src/YamlValidator/Program.cs b/src/YamlValidator/Program.cs
deleted file mode 100644
index c35c35d9..00000000
--- a/src/YamlValidator/Program.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) Microsoft Corporation.
-// Licensed under the MIT License.
-
-using System.CommandLine;
-
-namespace Microsoft.PowerPlatform.PowerApps.Persistence.YamlValidator;
-
-public class Program
-{
- private static void Main(string[] args)
- {
- var inputProcessor = InputProcessor.GetRootCommand();
- inputProcessor.Invoke(args);
- }
-}
diff --git a/src/YamlValidator/YamlValidator.csproj b/src/YamlValidator/YamlValidator.csproj
deleted file mode 100644
index 4a6b2b9f..00000000
--- a/src/YamlValidator/YamlValidator.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- enable
-
-
-
-
-
- 1591, CA1822
-
-
-
- 1591, CA1822
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-