Skip to content

Commit 5ecdfca

Browse files
Copilotarturcic
andcommitted
Add documentation for YamlDotNet source generator implementation
Co-authored-by: arturcic <[email protected]>
1 parent b885d9c commit 5ecdfca

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# YamlDotNet Source Generator
2+
3+
This project uses the YamlDotNet source generator infrastructure (`Vecc.YamlDotNet.Analyzers.StaticGenerator`) to prepare for Native AOT support.
4+
5+
## Current Status
6+
7+
The source generator infrastructure is in place but **not actively used** due to current limitations:
8+
9+
### Why Not Fully Implemented?
10+
11+
1. **Custom Type Inspector Limitation**: The generated `StaticTypeInspector` doesn't properly honor custom type inspectors, which GitVersion requires for `JsonPropertyName` attribute support
12+
2. **Dynamic Type Support**: The source generator doesn't support `Dictionary<object, object?>` used in override configurations
13+
3. **Property Compatibility**: Required changing `internal init` to `internal set` for all configuration properties
14+
15+
### What's Ready?
16+
17+
- `GitVersionConfigurationStaticContext` class with `[YamlStaticContext]` attribute
18+
- `[YamlSerializable]` attributes for main configuration types
19+
- Properties changed from `init` to `set` for generator compatibility
20+
- Source generator package reference and build integration
21+
22+
### Future Use
23+
24+
When YamlDotNet source generator improves support for:
25+
- Custom type inspectors
26+
- Init-only properties
27+
- Complex/dynamic types
28+
29+
We can enable it in `ConfigurationSerializer.cs` by uncommenting the static builder usage.
30+
31+
## References
32+
33+
- [Blog Post: Using YamlDotNet Source Generator for Native AOT](https://andrewlock.net/using-the-yamldotnet-source-generator-for-native-aot/)
34+
- [YamlDotNet Source Generator Package](https://www.nuget.org/packages/Vecc.YamlDotNet.Analyzers.StaticGenerator/)

0 commit comments

Comments
 (0)