Adds an attribute called IgnoreProperty that tells the generator to skip the property#44
Merged
StefH merged 6 commits intoStefH:mainfrom Jul 12, 2022
Merged
Adds an attribute called IgnoreProperty that tells the generator to skip the property#44StefH merged 6 commits intoStefH:mainfrom
StefH merged 6 commits intoStefH:mainfrom
Conversation
…gnore that property when making a builder.
… previous attribute that I defined is not introduced into the user's code.
…enerateBuilder] attribute.
…ally in the same namespace. if you know a better way to test this feel free to change it.
Ran the tests so that the autogenerator would inject the IgnoreProperty attribute into the tests and I could comment out the "cheat" attribute in SimpleClass.cs I also packed a dev version and installed it on my own current project and the ignore attribute works as expected.
Contributor
Author
|
Ok this PR is ready. I have moved the attribute to the Attribute Generator. And it works as expected. |
StefH
requested changes
Jul 1, 2022
| .AppendLine(" });"); | ||
| } | ||
|
|
||
| private const string IgnoreAttributeClassName = "FluentBuilder.IgnorePropertyAttribute"; |
Owner
|
@emorell96 please see my code review |
Contributor
Author
|
I'll get to them during the weekend :) I think they are a good idea. |
Owner
|
@emorell96 Did you have time yet to fix the comments? |
Owner
|
@emorell96 If you don't have the time, that's also fine. I can take over your branch/PR and update it. |
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
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.
I added an attribute that allows the user to set some properties as ignored for more control when generating a builder.
It allows me to bypass #43 by ignoring the property that breaks the code.
I tested the attribute by adding it to the SimpleClass and the test
FluentBuilderGeneratorTests.FluentBuilderSourceGeneratorTests.GenerateFiles_ForSimpleClass_Should_GenerateCorrectFilesshould fail if the property is not skipped since the generated code wouldn't match the expected code.The test passes, as do all the others:
