Cvoya.Graph.Analyzers
1.0.0
Prefix Reserved
dotnet add package Cvoya.Graph.Analyzers --version 1.0.0
NuGet\Install-Package Cvoya.Graph.Analyzers -Version 1.0.0
<PackageReference Include="Cvoya.Graph.Analyzers" Version="1.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Cvoya.Graph.Analyzers" Version="1.0.0" />
<PackageReference Include="Cvoya.Graph.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Cvoya.Graph.Analyzers --version 1.0.0
#r "nuget: Cvoya.Graph.Analyzers, 1.0.0"
#:package Cvoya.Graph.Analyzers@1.0.0
#addin nuget:?package=Cvoya.Graph.Analyzers&version=1.0.0
#tool nuget:?package=Cvoya.Graph.Analyzers&version=1.0.0
Downloadable open-source computer software from CVOYA. See the CVOYA software catalog.
Cvoya.Graph.Analyzers
Compile-time code analyzers for CVOYA graph - provides static analysis and validation of your graph entity models to catch issues early in the development cycle.
🚀 Quick Start
dotnet add package Cvoya.Graph.Analyzers
The analyzers are automatically enabled when you build your project. No additional configuration required!
// The analyzers will catch issues like this:
[Node("User")]
public class User : INode
{
// ❌ CG001: Missing parameterless constructor
public User(string name) { Name = name; }
// ❌ CG002: Property must have public getter and setter
[Property]
public string Name { get; private set; }
// ❌ CG004: Invalid property type for node
[Property]
public IGraph Graph { get; set; }
}
📦 Analyzer Rules
| Rule ID | Description | Severity |
|---|---|---|
| CG001 | Missing parameterless constructor | Error |
| CG002 | Property must have public accessors | Error |
| CG003 | Property cannot be graph interface type | Error |
| CG004 | Invalid property type for node | Error |
| CG005 | Invalid property type for relationship | Error |
| CG006 | Complex type contains graph interface types | Error |
| CG007 | Duplicate property attribute label | Error |
| CG008 | Duplicate relationship attribute label | Error |
| CG009 | Duplicate node attribute label | Error |
| CG010 | Circular reference without nullable | Error |
| CG011 | Type should inherit from Node/Relationship instead of implementing directly | Warning |
| CG012 | [Node]/[Relationship] on a type that doesn't implement the matching interface | Warning |
| CG013 | Both [Node] and [Relationship] applied to the same type | Error |
| CG014 | Graph entity types (INode/IRelationship) must be reference types | Error |
| CG015 | [ComplexProperty] has no effect on the configured property | Warning |
| CG016 | Open generic graph entities are not supported | Error |
| CG018 | Invalid graph key or ignored property declaration | Error |
🔧 Configuration
You can customize analyzer behavior in your .editorconfig:
# Disable specific rules
dotnet_diagnostic.CG007.severity = none
# Change severity levels
dotnet_diagnostic.CG010.severity = error
# Configure for specific files
[**/Generated/*.cs]
dotnet_diagnostic.CG001.severity = none
📋 Rule Details
CG001: Missing Parameterless Constructor
// ❌ Bad
[Node("User")]
public class User : INode
{
public User(string name) { /* ... */ }
}
// ✅ Good
[Node("User")]
public class User : INode
{
public User() { }
public User(string name) : this() { /* ... */ }
}
CG002: Property Must Have Public Accessors
// ❌ Bad
[Property]
public string Name { get; private set; }
// ✅ Good
[Property]
public string Name { get; set; }
CG003: Property Cannot Be Graph Interface Type
// ❌ Bad
[Property]
public IGraph Graph { get; set; }
[Property]
public INode RelatedNode { get; set; }
// ✅ Good - use relationships instead
public IGraph Graph => /* get from context */;
CG002, CG003, and CG006 inspect the same effective property set as runtime and generated
serialization: inherited public instance properties with a getter. Static properties, indexers,
non-public or write-only properties, and properties marked [Property(Ignore = true)] are excluded.
CG016: Open Generic Graph Entities Are Not Supported
// ❌ Bad - T is unbound where the non-generic serializer would be generated
public record GenericNode<T> : Node;
// ✅ Good - keep the reusable base abstract and expose a closed concrete entity
public abstract record GenericNode<T> : Node;
[Node("StringNode")]
public record StringNode : GenericNode<string>;
The serialization generator supports non-generic concrete entities built from closed generic constructions. It does not generate serializers for concrete open generic entity declarations or entities nested in an open generic containing type.
CG018: Invalid Graph Key or Ignored Property Declaration
// ❌ Bad - keys must be non-nullable graph-storable scalars
[Property(IsKey = true)]
public string? CustomerNumber { get; set; }
// ❌ Bad - ignored properties cannot request schema behavior
[Property(Ignore = true, IsUnique = true)]
public string ImportMarker { get; set; } = string.Empty;
// ✅ Good - multiple scalar declarations form a composite key
[Property(IsKey = true)]
public string Tenant { get; set; } = string.Empty;
[Property(IsKey = true)]
public long AccountNumber { get; set; }
Key declarations are opt-in. A keyless entity is valid, and a property named Id is ordinary mapped
data unless it explicitly sets IsKey = true. CG018 uses the same graph-storable scalar
classification as runtime schema validation. Existing property-type rules remain the single report
for types that are unsupported regardless of key configuration.
📚 Documentation
For comprehensive documentation, examples, and best practices:
🔗 Related Packages
- Cvoya.Graph.Neo4j - Neo4j database provider
- Cvoya.Graph.Serialization - Object serialization framework
- Cvoya.Graph.Serialization.CodeGen - Code generation for performant serialization/deserialization
- Cvoya.Graph.Analyzers - Compile-time code analyzers
🤝 Contributing
Contributions are welcome! Please see our Contributing Guide.
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Need help? Check the troubleshooting guide or open an issue.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 41 | 7/23/2026 |
| 1.0.0-alpha.20260717 | 72 | 7/17/2026 |