generated from AArnott/Library.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Generator Epic: Major Refactor #96
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
trippwill
wants to merge
11
commits into
main
Choose a base branch
from
feature/generator-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 65 out of 79 changed files in this pull request and generated 1 comment.
Files not reviewed (14)
- .editorconfig: Language not supported
- Directory.Packages.props: Language not supported
- src/SharpSchema.Annotations/SharpSchema.Annotations.csproj: Language not supported
- src/SharpSchema.Generator/GeneratorOptions.cs: Evaluated as low risk
- src/SharpSchema.Generator/LeafDeclaredTypeSyntaxVisitor.cs: Evaluated as low risk
- src/SharpSchema.Generator/RootSyntaxVisitor.cs: Evaluated as low risk
- src/SharpSchema.Generator/Model/Metadata.cs: Evaluated as low risk
- src/SharpSchema.Generator/Resolvers/EnumSymbolVisitor.cs: Evaluated as low risk
- src/SharpSchema.Annotations/DictionaryKeyMode.cs: Evaluated as low risk
- src/SharpSchema.Annotations/EnumMode.cs: Evaluated as low risk
- src/SharpSchema.Annotations/TraversalMode.cs: Evaluated as low risk
- src/SharpSchema.Annotations/AccessibilityMode.cs: Evaluated as low risk
- src/SharpSchema.Annotations/SchemaAccessibilityModeAttribute.cs: Evaluated as low risk
- src/SharpSchema.Annotations/GeneratorOptions.cs: Evaluated as low risk
Comments suppressed due to low confidence (3)
src/SharpSchema.Generator/LeafSyntaxVisitor.cs:188
- Ensure that the elementSchema resolution logic is robust. If elementSchema is null, it should handle the scenario appropriately.
if (elementSymbol.FindDeclaringSyntax() is BaseTypeDeclarationSyntax elx)
src/SharpSchema.Annotations/SchemaEnumModeAttribute.cs:12
- The constructor syntax used here might not be supported in all versions of C#. Consider using a standard constructor syntax:
public SchemaEnumModeAttribute(EnumMode value) : base() { Value = value; }
public class SchemaEnumModeAttribute(EnumMode value) : SchemaAttribute
src/SharpSchema.Annotations/SchemaDictionaryKeyModeAttribute.cs:10
- [nitpick] The AttributeUsage might be too broad. Consider specifying the exact members it supports.
[AttributeUsage(SchemaAttribute.SupportedMembers)]
Improved documentation for parameters in `GeneratorOptions.cs` and added a new `NumberMode` parameter with default value `StrictDefs`. Introduced `NumberMode.cs` with an enumeration defining `StrictDefs`, `StrictInline`, and `JsonNative`. Updated access modifiers from `public` to `internal` for various attributes in the `SharpSchema.Annotations` namespace, along with enhanced documentation for clarity.
- Added `.runsettings` and `nvim-diff.runsettings` for diff engine configurations. - Refactored `GeneratorOptions` to use `init` properties for better immutability. - Removed `SchemaNumberModeAttribute` class to simplify code. - Introduced `Unsupported` class for centralized error messaging in schema generation. - Improved `LeafSyntaxVisitor` for better caching and error handling. - Streamlined schema creation in `CommonSchemas`. - Updated `MemberMeta` for more user-friendly title generation. - Renamed and refactored `TypeSchemaSymbolVisitor` to `NamedTypeSymbolVisitor`. - Enhanced `VerifyTests` with new verification methods and improved organization. - Updated test data files to reflect schema changes, including new records and properties. - Added verification files for accessibility and number modes. - Introduced new test cases for dictionary key modes and enum modes. - Updated `vscode-diff.runsettings` for Visual Studio Code configuration.
- Removed `IsExternalInit` package version from `Directory.Packages.props`. - Added `PackageReference` for `PolySharp` in `SharpSchema.Annotations.Source.csproj`. - Replaced `IsExternalInit` with `PolySharp` in `SharpSchema.Annotations.csproj`, maintaining asset settings.
- Updated `NamedTypeSymbolVisitor` to improve `WasLastPropertyRequired` evaluation using `IsRequired`. - Simplified `AnnotationExtensions` to rely solely on `SchemaIgnoreAttribute` for ignoring symbols. - Expanded `VerifyTests` to cover new and modified classes and records.
Enhance the NamedTypeSymbolVisitor to support schema overrides for properties and constructors, refining the logic for required properties and default values. Expand VerifyTests with additional cases to validate the new functionality.
- Changed `GeneratorOptions` from a class to a record, adding properties for `AccessibilityMode`, `TraversalMode`, `DictionaryKeyMode`, `EnumMode`, and `NumberMode`. - Introduced `ObjectAttributes` and `PropertyAttributes` records to handle various attribute properties. - Updated `NamedTypeSymbolVisitor` and `EnumSymbolVisitor` to utilize new traversal modes. - Added `GetAttributeHandler` methods in `SymbolExtensions` for easier attribute retrieval. - Enhanced `JsonSchemaBuilderExtensions` with a method to merge properties. - Modified `VerifyTests` to include new test cases and adjust existing ones. - Updated test data classes to reflect changes in `SchemaTraversalMode`. - Revised verification files to align with the new schema structure.
This commit introduces a `RootContext` class to encapsulate the context for schema generation, simplifying the `LeafSyntaxVisitor` and `NamedTypeResolver` classes. The `CommonSchemas` class has been enhanced for better handling of unsupported objects and schema references. Visitor classes have been documented for clarity, and new utility methods have been added to improve schema generation options. Additionally, property and parameter handling has been refined, and test data has been updated to ensure accuracy in generated schemas. These changes enhance maintainability, readability, and functionality of the code.
- Updated `GeneratorOptions` to include a constructor for copying values from another instance, improving flexibility. - Changed attribute usage in `SchemaAccessibilityModeAttribute.cs` from `SupportedMembers` to `SupportedTypes`. - Modified `NamedTypeResolver` to preserve original options when processing parameters and properties, enhancing schema generation accuracy. - Added new test classes and methods to verify accessibility overrides in schema generation. - Updated `TestDataFixture` to include a path to the new accessibility test data file. - Added or updated JSON schema verification files to reflect new accessibility rules. - Enhanced `VerifyTests` with new test cases for accessibility overrides.
Updated `ObjectAttributes` and `PropertyAttributes` to reintroduce `TraversalMode` and `ValueRange` attribute handlers. Modified `GeneratorOptionsExtensions` to adjust how `DictionaryKeyMode` is handled. Added new classes in `TestData.Attributes.cs` for various dictionary key scenarios and updated test references accordingly. Created new JSON schema files for these scenarios and added a test method in `VerifyTests.cs` to validate the schemas, improving test coverage.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces a SymbolVisitor to simply some of the type schema generation logic.
Introduces a new solution for handling abstract type schemas, and generic type schemas.