Add "generated-code" XmlDoc and [GeneratedCode]
attribute to C# models.
#1784
Labels
area/typescript
Specify what technical area given issue relates to. Its goal is to ease filtering good first issues.
C# generator
Anything related to the C# generator
enhancement
New feature or request
good first issue
Good for newcomers
stale
It's very common in the C# generator world to add the GeneratedCodeAttribute to generated code.
For example:
I would also suggest adding a documentation header to the generated code:
Reason/Context
Please try answering few of those questions
Why we need this improvement?
These two methods of marking generated code are frequently used as part of a heuristic test to determine if code is generated. This may be done to, for example, exclude it from code coverage or static analysis checks,
How will this change help?
This change will clearly mark generated code as generated, in line with standard dotnet practices and customs.
What is the motivation?
Excluding generated code from static analysis tooling is the driving motivation.
Description
Please try answering few of those questions
What changes have to be introduced?
Will this be a breaking change?
No - the xmldoc comments are just comments, and thus compiled out.
The
GeneratedCode
attribute is extremely unlikely to cause downstream issues - it would require a developer to be enabling a behaviour in the absence of a[GeneratedCode]
attribute and to want that behaviour to apply to this generated code.This issue was initially discussed in Slack.
@jonaslagoni suggested
Note that this issue is similar to #1330.
The text was updated successfully, but these errors were encountered: