Skip to content

Commit cabb891

Browse files
Support additional input types and fix YAML type deserialization (#7)
Fix boolean values not being treated properly during deserialization. Fixes #5 Support JSON input files. Fixes #6 Documentation fixes
1 parent 373969b commit cabb891

27 files changed

+840
-366
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ jobs:
6262
run: dotnet nuget add source ${{ github.workspace }}/nuget/local --name AggregateConfigBuildTask
6363

6464
- name: Restore IntegrationTests with custom AggregateConfigBuildTask package
65-
run: dotnet restore test/IntegrationTests/IntegrationTests.csproj
65+
run: dotnet restore test/IntegrationTests.sln
6666

6767
- name: Build IntegrationTests in Release mode
68-
run: dotnet build test/IntegrationTests/IntegrationTests.csproj --configuration Release -warnaserror
68+
run: dotnet build test/IntegrationTests.sln --configuration Release -warnaserror
6969

7070
- name: Run IntegrationTests
71-
run: dotnet test test/IntegrationTests/IntegrationTests.csproj --configuration Release -warnaserror
71+
run: dotnet test test/IntegrationTests.sln --configuration Release -warnaserror
7272

7373
- name: Upload integration results artifact
7474
uses: actions/upload-artifact@v4

README.md

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Features
1111

12-
- Merge multiple YAML configuration files into a single output format (JSON, Azure ARM parameters, or YAML).
12+
- Merge multiple configuration files into a single output format (JSON, Azure ARM parameters, or YAML).
1313
- Support for injecting custom metadata (e.g., `ResourceGroup`, `Environment`) into the output.
1414
- Optionally include the source file name in each configuration entry.
1515
- Embed output files as resources in the assembly for easy inclusion in your project.
@@ -25,7 +25,10 @@ dotnet add package AggregateConfigBuildTask
2525
Alternatively, add the following line to your `.csproj` file:
2626

2727
```xml
28-
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0" />
28+
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.1">
29+
<PrivateAssets>all</PrivateAssets>
30+
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
31+
</PackageReference>
2932
```
3033

3134
## Usage
@@ -37,13 +40,6 @@ In your `.csproj` file, use the task to aggregate YAML files and output them in
3740
```xml
3841
<Project Sdk="Microsoft.NET.Sdk">
3942

40-
<ItemGroup>
41-
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
42-
<PrivateAssets>all</PrivateAssets>
43-
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
44-
</PackageReference>
45-
</ItemGroup>
46-
4743
<Target Name="AggregateConfigs" BeforeTargets="PrepareForBuild">
4844
<ItemGroup>
4945
<AdditionalProperty Include="ResourceGroup=TestRG" />
@@ -54,6 +50,7 @@ In your `.csproj` file, use the task to aggregate YAML files and output them in
5450
InputDirectory="Configs"
5551
OutputFile="$(MSBuildProjectDirectory)\out\output.json"
5652
AddSourceProperty="true"
53+
InputType="Yaml"
5754
OutputType="Json"
5855
AdditionalProperties="@(AdditionalProperty)" />
5956
</Target>
@@ -74,13 +71,6 @@ You can also generate Azure ARM template parameters. Here's how to modify the co
7471
```xml
7572
<Project Sdk="Microsoft.NET.Sdk">
7673

77-
<ItemGroup>
78-
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
79-
<PrivateAssets>all</PrivateAssets>
80-
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
81-
</PackageReference>
82-
</ItemGroup>
83-
8474
<Target Name="AggregateConfigsForARM" BeforeTargets="PrepareForBuild">
8575
<ItemGroup>
8676
<AdditionalProperty Include="ResourceGroup=TestRG" />
@@ -90,7 +80,7 @@ You can also generate Azure ARM template parameters. Here's how to modify the co
9080
<AggregateConfig
9181
InputDirectory="Configs"
9282
OutputFile="$(MSBuildProjectDirectory)\out\output.parameters.json"
93-
OutputType="ArmParameter"
83+
OutputType="Arm"
9484
AdditionalProperties="@(AdditionalProperty)" />
9585
</Target>
9686

@@ -104,13 +94,6 @@ You can also output the aggregated configuration back into YAML format:
10494
```xml
10595
<Project Sdk="Microsoft.NET.Sdk">
10696

107-
<ItemGroup>
108-
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
109-
<PrivateAssets>all</PrivateAssets>
110-
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
111-
</PackageReference>
112-
</ItemGroup>
113-
11497
<Target Name="AggregateConfigsToYAML" BeforeTargets="PrepareForBuild">
11598
<ItemGroup>
11699
<AdditionalProperty Include="ResourceGroup=TestRG" />
@@ -134,13 +117,6 @@ You can embed the output files (such as the generated JSON) as resources in the
134117
```xml
135118
<Project Sdk="Microsoft.NET.Sdk">
136119

137-
<ItemGroup>
138-
<PackageReference Include="AggregateConfigBuildTask" Version="1.0.0">
139-
<PrivateAssets>all</PrivateAssets>
140-
<ExcludeAssets>native;contentFiles;analyzers;runtime</ExcludeAssets>
141-
</PackageReference>
142-
</ItemGroup>
143-
144120
<Target Name="AggregateConfigs" BeforeTargets="PrepareForBuild">
145121
<ItemGroup>
146122
<AdditionalProperty Include="ResourceGroup=TestRG" />
@@ -173,8 +149,11 @@ In this example:
173149
- **AddSourceProperty** *(optional, default=false)*: Adds a `source` property to each object in the output, indicating the YAML file it originated from.
174150
- **OutputType** *(required)*: Determines the output format. Supported values:
175151
- `Json`: Outputs a regular JSON file.
176-
- `ArmParameter`: Outputs an Azure ARM template parameter file.
152+
- `Arm`: Outputs an Azure ARM template parameter file.
177153
- `Yaml`: Outputs a YAML file.
154+
- **InputType** *(optional, default=YAML)*: Determines the input format. Supported values:
155+
- `Json`: Inputs are JSON files with a `.json` extension.
156+
- `Yaml`: Inputs are YAML files with a `.yml` or `.yaml` extension.
178157
- **AdditionalProperties** *(optional)*: A collection of custom top-level properties to inject into the final output. Use the `ItemGroup` syntax to pass key-value pairs.
179158

180159
## Example YAML Input
@@ -256,7 +235,17 @@ resources:
256235

257236
## License
258237

259-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
238+
This project is licensed under the MIT License. See the [LICENSE](https://github.com/richardsondev/AggregateConfigBuildTask/blob/main/LICENSE) file for details.
239+
240+
## Third-Party Libraries
241+
242+
This project leverages the following third-party libraries:
243+
244+
- **[YamlDotNet](https://github.com/aaubry/YamlDotNet)**
245+
Used for YAML serialization and deserialization. YamlDotNet is distributed under the MIT License. For detailed information, refer to the [YamlDotNet License](https://github.com/aaubry/YamlDotNet/blob/master/LICENSE.txt).
246+
247+
- **[YamlDotNet.System.Text.Json](https://github.com/IvanJosipovic/YamlDotNet.System.Text.Json)**
248+
Facilitates type handling for YAML serialization and deserialization, enhancing compatibility with System.Text.Json. This library is also distributed under the MIT License. For more details, see the [YamlDotNet.System.Text.Json License](https://github.com/IvanJosipovic/YamlDotNet.System.Text.Json/blob/main/LICENSE).
260249

261250
## Contributing
262251

src/Contracts/OutputTypeEnum.cs renamed to src/Contracts/InputOutputEnums.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ public enum OutputTypeEnum
44
{
55
Json,
66
Arm,
7+
ArmParameter = Arm,
8+
Yml,
9+
Yaml = Yml
10+
}
11+
12+
public enum InputTypeEnum
13+
{
14+
Json,
715
Yml,
816
Yaml = Yml
917
}

0 commit comments

Comments
 (0)