-
Notifications
You must be signed in to change notification settings - Fork 741
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
Added "gets or sets" rule for the model template in the CSharp code generator #989
Closed
Closed
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1afef7d
Added gets or sets property rule for model template
brnleehng 713465c
Merge branch 'master' into feature/doc-strings
brnleehng 786f94e
Added regenerated expected tests
brnleehng 40e49d0
Merge branch 'feature/doc-strings' of github.com:brnleehng/autorest i…
brnleehng 1288102
Edited to check null or empty property descriptions
brnleehng dc30d8a
Added regenerated tests with models
brnleehng 896616b
Merge branch 'master' into feature/doc-strings
brnleehng 2976efe
Using Property class and added Culture.Invariant
brnleehng 1fcdafa
Using Property class and added Culture.Invariant
brnleehng 18ec9cd
Merge branch 'feature/doc-strings' of github.com:brnleehng/autorest i…
brnleehng 2622aaa
Merge branch 'master' into feature/doc-strings
brnleehng 45618ea
Property calls its own method now
brnleehng 54beae9
Added trim start to client model extensions
brnleehng 53e7c55
Merge branch 'master' into feature/doc-strings
brnleehng ac7232d
Merge branch 'master' into feature/doc-strings
brnleehng 0f01672
Merge branch 'feature/doc-strings' of github.com:brnleehng/autorest i…
brnleehng 431b98e
Reverted trim start
brnleehng 423bdfa
Added trim to documentation string
brnleehng 8641c7a
Fixed documentation string and added return string
brnleehng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,8 +137,13 @@ private static bool ShouldValidate(this IType model) | |
/// </summary> | ||
/// <param name="property">The given property documentation to format</param> | ||
/// <returns></returns> | ||
public static string GetFormattedPropertyDocumentation(PropertyTemplateModel property) | ||
public static string GetFormattedPropertyDocumentation(Property property) | ||
{ | ||
if (property == null) | ||
{ | ||
throw new ArgumentNullException("property"); | ||
} | ||
|
||
if (string.IsNullOrEmpty(property.Documentation)) | ||
{ | ||
return property.Documentation.EscapeXmlComment(); | ||
|
@@ -149,13 +154,13 @@ public static string GetFormattedPropertyDocumentation(PropertyTemplateModel pro | |
string firstWord = property.Documentation.Split(' ').First(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you trim the start of the Documetation to ensure there aren't any leading spaces? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I'll make that change |
||
if (firstWord.Length <= 1) | ||
{ | ||
documentation += char.ToLower(property.Documentation[0]) + property.Documentation.Substring(1); | ||
documentation += char.ToLower(property.Documentation[0], CultureInfo.InvariantCulture) + property.Documentation.Substring(1); | ||
} | ||
else | ||
{ | ||
documentation += firstWord.ToUpper() == firstWord | ||
? property.Documentation | ||
: char.ToLower(property.Documentation[0]) + property.Documentation.Substring(1); | ||
: char.ToLower(property.Documentation[0], CultureInfo.InvariantCulture) + property.Documentation.Substring(1); | ||
} | ||
|
||
return documentation.EscapeXmlComment(); | ||
|
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.
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.
Could you make this an extension method like the other methods in this file? That way you can just call property.GetFormattedPropertyDocumentation()
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.
Okay will make this change