Skip to content

Commit

Permalink
Fix for Issue Azure#1202 (Azure#1235)
Browse files Browse the repository at this point in the history
* Added a check to make sure the property.documentation doesn't already start with Gets before appending it as a prefix

* Regenerated CSharp tests
  • Loading branch information
John-Hart authored and fearthecowboy committed Jul 11, 2016
1 parent a9acdd5 commit 93de90c
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,23 @@ public CheckNameAvailabilityResult() { }
}

/// <summary>
/// Gets or sets gets a boolean value that indicates whether the name
/// is available for you to use. If true, the name is available. If
/// false, the name has already been taken or invalid and cannot be
/// used.
/// Gets a boolean value that indicates whether the name is available
/// for you to use. If true, the name is available. If false, the
/// name has already been taken or invalid and cannot be used.
/// </summary>
[JsonProperty(PropertyName = "nameAvailable")]
public bool? NameAvailable { get; set; }

/// <summary>
/// Gets or sets gets the reason that a storage account name could not
/// be used. The Reason element is only returned if NameAvailable is
/// false. Possible values include: 'AccountNameInvalid',
/// 'AlreadyExists'
/// Gets the reason that a storage account name could not be used. The
/// Reason element is only returned if NameAvailable is false.
/// Possible values include: 'AccountNameInvalid', 'AlreadyExists'
/// </summary>
[JsonProperty(PropertyName = "reason")]
public Reason? Reason { get; set; }

/// <summary>
/// Gets or sets gets an error message explaining the Reason value in
/// more detail.
/// Gets an error message explaining the Reason value in more detail.
/// </summary>
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions Samples/azure-storage/Azure.CSharp/Models/CustomDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public CustomDomain() { }
}

/// <summary>
/// Gets or sets gets or sets the custom domain name. Name is the
/// CNAME source.
/// Gets or sets the custom domain name. Name is the CNAME source.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
Expand Down
8 changes: 4 additions & 4 deletions Samples/azure-storage/Azure.CSharp/Models/Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ public Endpoints() { }
}

/// <summary>
/// Gets or sets gets the blob endpoint.
/// Gets the blob endpoint.
/// </summary>
[JsonProperty(PropertyName = "blob")]
public string Blob { get; set; }

/// <summary>
/// Gets or sets gets the queue endpoint.
/// Gets the queue endpoint.
/// </summary>
[JsonProperty(PropertyName = "queue")]
public string Queue { get; set; }

/// <summary>
/// Gets or sets gets the table endpoint.
/// Gets the table endpoint.
/// </summary>
[JsonProperty(PropertyName = "table")]
public string Table { get; set; }

/// <summary>
/// Gets or sets gets the file endpoint.
/// Gets the file endpoint.
/// </summary>
[JsonProperty(PropertyName = "file")]
public string File { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public StorageAccountKeys() { }
}

/// <summary>
/// Gets or sets gets the value of key 1.
/// Gets the value of key 1.
/// </summary>
[JsonProperty(PropertyName = "key1")]
public string Key1 { get; set; }

/// <summary>
/// Gets or sets gets the value of key 2.
/// Gets the value of key 2.
/// </summary>
[JsonProperty(PropertyName = "key2")]
public string Key2 { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,89 +46,87 @@ public StorageAccountProperties() { }
}

/// <summary>
/// Gets or sets gets the status of the storage account at the time
/// the operation was called. Possible values include: 'Creating',
/// 'ResolvingDNS', 'Succeeded'
/// Gets the status of the storage account at the time the operation
/// was called. Possible values include: 'Creating', 'ResolvingDNS',
/// 'Succeeded'
/// </summary>
[JsonProperty(PropertyName = "provisioningState")]
public ProvisioningState? ProvisioningState { get; set; }

/// <summary>
/// Gets or sets gets the type of the storage account. Possible values
/// include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS',
/// 'Standard_RAGRS', 'Premium_LRS'
/// Gets the type of the storage account. Possible values include:
/// 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS',
/// 'Premium_LRS'
/// </summary>
[JsonProperty(PropertyName = "accountType")]
public AccountType? AccountType { get; set; }

/// <summary>
/// Gets or sets gets the URLs that are used to perform a retrieval of
/// a public blob, queue or table object.Note that StandardZRS and
/// PremiumLRS accounts only return the blob endpoint.
/// Gets the URLs that are used to perform a retrieval of a public
/// blob, queue or table object.Note that StandardZRS and PremiumLRS
/// accounts only return the blob endpoint.
/// </summary>
[JsonProperty(PropertyName = "primaryEndpoints")]
public Endpoints PrimaryEndpoints { get; set; }

/// <summary>
/// Gets or sets gets the location of the primary for the storage
/// account.
/// Gets the location of the primary for the storage account.
/// </summary>
[JsonProperty(PropertyName = "primaryLocation")]
public string PrimaryLocation { get; set; }

/// <summary>
/// Gets or sets gets the status indicating whether the primary
/// location of the storage account is available or unavailable.
/// Possible values include: 'Available', 'Unavailable'
/// Gets the status indicating whether the primary location of the
/// storage account is available or unavailable. Possible values
/// include: 'Available', 'Unavailable'
/// </summary>
[JsonProperty(PropertyName = "statusOfPrimary")]
public AccountStatus? StatusOfPrimary { get; set; }

/// <summary>
/// Gets or sets gets the timestamp of the most recent instance of a
/// failover to the secondary location. Only the most recent
/// timestamp is retained. This element is not returned if there has
/// never been a failover instance. Only available if the accountType
/// is StandardGRS or StandardRAGRS.
/// Gets the timestamp of the most recent instance of a failover to
/// the secondary location. Only the most recent timestamp is
/// retained. This element is not returned if there has never been a
/// failover instance. Only available if the accountType is
/// StandardGRS or StandardRAGRS.
/// </summary>
[JsonProperty(PropertyName = "lastGeoFailoverTime")]
public DateTime? LastGeoFailoverTime { get; set; }

/// <summary>
/// Gets or sets gets the location of the geo replicated secondary for
/// the storage account. Only available if the accountType is
/// StandardGRS or StandardRAGRS.
/// Gets the location of the geo replicated secondary for the storage
/// account. Only available if the accountType is StandardGRS or
/// StandardRAGRS.
/// </summary>
[JsonProperty(PropertyName = "secondaryLocation")]
public string SecondaryLocation { get; set; }

/// <summary>
/// Gets or sets gets the status indicating whether the secondary
/// location of the storage account is available or unavailable. Only
/// available if the accountType is StandardGRS or StandardRAGRS.
/// Possible values include: 'Available', 'Unavailable'
/// Gets the status indicating whether the secondary location of the
/// storage account is available or unavailable. Only available if
/// the accountType is StandardGRS or StandardRAGRS. Possible values
/// include: 'Available', 'Unavailable'
/// </summary>
[JsonProperty(PropertyName = "statusOfSecondary")]
public AccountStatus? StatusOfSecondary { get; set; }

/// <summary>
/// Gets or sets gets the creation date and time of the storage
/// account in UTC.
/// Gets the creation date and time of the storage account in UTC.
/// </summary>
[JsonProperty(PropertyName = "creationTime")]
public DateTime? CreationTime { get; set; }

/// <summary>
/// Gets or sets gets the user assigned custom domain assigned to this
/// storage account.
/// Gets the user assigned custom domain assigned to this storage
/// account.
/// </summary>
[JsonProperty(PropertyName = "customDomain")]
public CustomDomain CustomDomain { get; set; }

/// <summary>
/// Gets or sets gets the URLs that are used to perform a retrieval of
/// a public blob, queue or table object from the secondary location
/// of the storage account. Only available if the accountType is
/// Gets the URLs that are used to perform a retrieval of a public
/// blob, queue or table object from the secondary location of the
/// storage account. Only available if the accountType is
/// StandardRAGRS.
/// </summary>
[JsonProperty(PropertyName = "secondaryEndpoints")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public StorageAccountPropertiesCreateParameters(AccountType accountType)
}

/// <summary>
/// Gets or sets gets or sets the account type. Possible values
/// include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS',
/// 'Standard_RAGRS', 'Premium_LRS'
/// Gets or sets the account type. Possible values include:
/// 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS',
/// 'Premium_LRS'
/// </summary>
[JsonProperty(PropertyName = "accountType")]
public AccountType AccountType { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public StorageAccountPropertiesUpdateParameters() { }
}

/// <summary>
/// Gets or sets gets or sets the account type. Note that StandardZRS
/// and PremiumLRS accounts cannot be changed to other account types,
/// and other account types cannot be changed to StandardZRS or
/// Gets or sets the account type. Note that StandardZRS and
/// PremiumLRS accounts cannot be changed to other account types, and
/// other account types cannot be changed to StandardZRS or
/// PremiumLRS. Possible values include: 'Standard_LRS',
/// 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS'
/// </summary>
Expand Down
15 changes: 7 additions & 8 deletions Samples/azure-storage/Azure.CSharp/Models/Usage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,28 @@ public Usage(UsageUnit unit, int currentValue, int limit, UsageName name)
}

/// <summary>
/// Gets or sets gets the unit of measurement. Possible values
/// include: 'Count', 'Bytes', 'Seconds', 'Percent',
/// 'CountsPerSecond', 'BytesPerSecond'
/// Gets the unit of measurement. Possible values include: 'Count',
/// 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond'
/// </summary>
[JsonProperty(PropertyName = "unit")]
public UsageUnit Unit { get; set; }

/// <summary>
/// Gets or sets gets the current count of the allocated resources in
/// the subscription.
/// Gets the current count of the allocated resources in the
/// subscription.
/// </summary>
[JsonProperty(PropertyName = "currentValue")]
public int CurrentValue { get; set; }

/// <summary>
/// Gets or sets gets the maximum count of the resources that can be
/// allocated in the subscription.
/// Gets the maximum count of the resources that can be allocated in
/// the subscription.
/// </summary>
[JsonProperty(PropertyName = "limit")]
public int Limit { get; set; }

/// <summary>
/// Gets or sets gets the name of the type of usage.
/// Gets the name of the type of usage.
/// </summary>
[JsonProperty(PropertyName = "name")]
public UsageName Name { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Samples/azure-storage/Azure.CSharp/Models/UsageName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public UsageName() { }
}

/// <summary>
/// Gets or sets gets a string describing the resource name.
/// Gets a string describing the resource name.
/// </summary>
[JsonProperty(PropertyName = "value")]
public string Value { get; set; }

/// <summary>
/// Gets or sets gets a localized string describing the resource name.
/// Gets a localized string describing the resource name.
/// </summary>
[JsonProperty(PropertyName = "localizedValue")]
public string LocalizedValue { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public HeaderCustomNamedRequestIdHeaders() { }
}

/// <summary>
/// Gets or sets gets the foo-request-id.
/// Gets the foo-request-id.
/// </summary>
[JsonProperty(PropertyName = "foo-request-id")]
public string FooRequestId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public HeaderCustomNamedRequestIdParamGroupingHeaders() { }
}

/// <summary>
/// Gets or sets gets the foo-request-id.
/// Gets the foo-request-id.
/// </summary>
[JsonProperty(PropertyName = "foo-request-id")]
public string FooRequestId { get; set; }
Expand Down
23 changes: 15 additions & 8 deletions src/generator/AutoRest.CSharp/ClientModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,28 @@ public static string GetFormattedPropertySummary(this Property property)
return null;
}

string documentation = property.IsReadOnly ? "Gets " : "Gets or sets ";
string documentation = String.Empty;
string summary = string.IsNullOrEmpty(property.Summary) ? property.Documentation : property.Summary;

string firstWord = summary.TrimStart().Split(' ').First();
if (firstWord.Length <= 1)
if (summary.TrimStart().StartsWith("Gets ", StringComparison.OrdinalIgnoreCase))
{
documentation += char.ToLower(summary[0], CultureInfo.InvariantCulture) + summary.Substring(1);
documentation = summary;
}
else
{
documentation += firstWord.ToUpper(CultureInfo.InvariantCulture) == firstWord
? summary
: char.ToLower(summary[0], CultureInfo.InvariantCulture) + summary.Substring(1);
documentation = property.IsReadOnly ? "Gets " : "Gets or sets ";
string firstWord = summary.TrimStart().Split(' ').First();
if (firstWord.Length <= 1)
{
documentation += char.ToLower(summary[0], CultureInfo.InvariantCulture) + summary.Substring(1);
}
else
{
documentation += firstWord.ToUpper(CultureInfo.InvariantCulture) == firstWord
? summary
: char.ToLower(summary[0], CultureInfo.InvariantCulture) + summary.Substring(1);
}
}

return documentation.EscapeXmlComment();
}

Expand Down

0 comments on commit 93de90c

Please sign in to comment.