Skip to content

Commit

Permalink
Improve support for "Summary" and "Description" documentation fields (A…
Browse files Browse the repository at this point in the history
…zure#1163)

* Increase support for "Summary" and "Description"

 - Fix bug where Indentation parameter of Template.cs
   counted text after the indentation too.
 - Update PetStore sample slightly.
 - Add support for "Title" field in JSON entities (which maps onto "Summary" field)

* Regenerate samples

* Regenerate tests
  • Loading branch information
matthchr authored and tbombach committed Jun 16, 2016
1 parent 6b71dda commit 61d1467
Show file tree
Hide file tree
Showing 318 changed files with 1,843 additions and 1,886 deletions.
5 changes: 5 additions & 0 deletions AutoRest/AutoRest.Core/ClientModel/CompositeType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public IEnumerable<Property> ComposedProperties
/// </summary>
public string PolymorphicDiscriminator { get; set; }

/// <summary>
/// Gets or sets the summary.
/// </summary>
public string Summary { get; set; }

/// <summary>
/// Gets or sets the CompositeType documentation.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions AutoRest/AutoRest.Core/ClientModel/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public Property()
/// </summary>
public Dictionary<Constraint, string> Constraints { get; private set; }

/// <summary>
/// Gets or sets the summary.
/// </summary>
public string Summary { get; set; }

/// <summary>
/// Gets or sets the documentation.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion AutoRest/AutoRest.Core/Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ protected string Indentation
break;
}
}
return _lastLiteral.Substring(lineStart, _lastLiteral.Length - lineStart);
string latestLine = _lastLiteral.Substring(lineStart, _lastLiteral.Length - lineStart);
return new string(latestLine.TakeWhile(char.IsWhiteSpace).ToArray());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,12 @@ private void Initialize()
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='resourceGroupName'>
/// Resource Group ID.
/// </param>
Expand Down Expand Up @@ -535,7 +537,9 @@ private void Initialize()
/// <summary>
/// Create products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription ID.
/// </param>
Expand Down Expand Up @@ -730,7 +734,9 @@ private void Initialize()
/// <summary>
/// Update products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription ID.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ public static partial class AzureCompositeModelExtensions
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -43,10 +45,12 @@ public static CatalogArray List(this IAzureCompositeModel operations, string res
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -67,7 +71,9 @@ public static CatalogArray List(this IAzureCompositeModel operations, string res
/// <summary>
/// Create products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -88,7 +94,9 @@ public static CatalogArray List(this IAzureCompositeModel operations, string res
/// <summary>
/// Create products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -115,7 +123,9 @@ public static CatalogArray List(this IAzureCompositeModel operations, string res
/// <summary>
/// Update products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -136,7 +146,9 @@ public static CatalogArray List(this IAzureCompositeModel operations, string res
/// <summary>
/// Update products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ public partial interface IAzureCompositeModel : IDisposable
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products
/// offered at a given location. The response includes the display
/// name and other details about each product, and lists the products
/// in the proper display order.
/// </remarks>
/// <param name='resourceGroupName'>
/// Resource Group ID.
/// </param>
Expand All @@ -128,7 +130,9 @@ public partial interface IAzureCompositeModel : IDisposable
/// <summary>
/// Create products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription ID.
/// </param>
Expand All @@ -149,7 +153,9 @@ public partial interface IAzureCompositeModel : IDisposable
/// <summary>
/// Update products
/// </summary>
/// <remarks>
/// Resets products.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription ID.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ if (!string.IsNullOrWhiteSpace(Model.ExternalDocsUrl))
}
if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
{
@:/// <remarks>
@:@WrapComment("/// ", Model.Description.EscapeXmlComment())
@:/// </remarks>
}
foreach (var parameter in Model.LocalParameters)
{
Expand Down Expand Up @@ -65,7 +67,9 @@ if (!string.IsNullOrWhiteSpace(Model.ExternalDocsUrl))
}
if (!String.IsNullOrEmpty(Model.Description) && !String.IsNullOrEmpty(Model.Summary))
{
@:/// <remarks>
@:@WrapComment("/// ", Model.Description.EscapeXmlComment())
@:/// </remarks>
}
foreach (var parameter in Model.LocalParameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public partial interface IPolymorphicAnimalStore : IDisposable
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products
/// offered at a given location. The response includes the display
/// name and other details about each product, and lists the products
/// in the proper display order.
/// </remarks>
/// <param name='animalCreateOrUpdateParameter'>
/// An Animal
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ private void Initialize()
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='animalCreateOrUpdateParameter'>
/// An Animal
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ public static partial class PolymorphicAnimalStoreExtensions
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -42,10 +44,12 @@ public static partial class PolymorphicAnimalStoreExtensions
/// <summary>
/// Product Types
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public partial interface IRecursiveTypesAPI : IDisposable
/// <summary>
/// Products
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products
/// offered at a given location. The response includes the display
/// name and other details about each product, and lists the products
/// in the proper display order.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription Id.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ private void Initialize()
/// <summary>
/// Products
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='subscriptionId'>
/// Subscription Id.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ public static partial class RecursiveTypesAPIExtensions
/// <summary>
/// Products
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand All @@ -51,10 +53,12 @@ public static partial class RecursiveTypesAPIExtensions
/// <summary>
/// Products
/// </summary>
/// <remarks>
/// The Products endpoint returns information about the Uber products offered
/// at a given location. The response includes the display name and other
/// details about each product, and lists the products in the proper display
/// order.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
/// Multiple status values can be provided with comma seperated strings
/// </remarks>
/// <param name='status'>
/// Status values that need to be considered for filter
/// </param>
Expand All @@ -94,8 +96,10 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
/// Muliple tags can be provided with comma seperated strings. Use
/// tag1, tag2, tag3 for testing.
/// </remarks>
/// <param name='tags'>
/// Tags to filter by
/// </param>
Expand All @@ -110,7 +114,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Find pet by Id
/// </summary>
/// <remarks>
/// Returns a single pet
/// </remarks>
/// <param name='petId'>
/// Id of pet to return
/// </param>
Expand Down Expand Up @@ -164,7 +170,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
Expand All @@ -190,8 +198,10 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Find purchase order by Id
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10.
/// Other values will generated exceptions
/// </remarks>
/// <param name='orderId'>
/// Id of pet that needs to be fetched
/// </param>
Expand All @@ -206,8 +216,10 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Delete purchase order by Id
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt; 1000. Anything
/// above 1000 or nonintegers will generate API errors
/// </remarks>
/// <param name='orderId'>
/// Id of the order that needs to be deleted
/// </param>
Expand All @@ -222,7 +234,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Create user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name='body'>
/// Created user object
/// </param>
Expand Down Expand Up @@ -307,7 +321,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name='username'>
/// name that need to be deleted
/// </param>
Expand All @@ -325,7 +341,9 @@ public partial interface ISwaggerPetstoreV2 : IDisposable
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name='username'>
/// The name that needs to be deleted
/// </param>
Expand Down
Loading

0 comments on commit 61d1467

Please sign in to comment.