set $top example
This commit is contained in:
parent
79606c7511
commit
8418bbdb99
|
@ -29,12 +29,12 @@ namespace Microsoft.OpenApi.OData.Generator
|
|||
public static IDictionary<string, OpenApiParameter> CreateParameters(this ODataContext context)
|
||||
{
|
||||
Utils.CheckArgumentNull(context, nameof(context));
|
||||
|
||||
|
||||
// It allows defining query options and headers that can be reused across operations of the service.
|
||||
// The value of parameters is a map of Parameter Objects.
|
||||
return new Dictionary<string, OpenApiParameter>
|
||||
{
|
||||
{ "top", CreateTop() },
|
||||
{ "top", CreateTop(context.Settings.TopExample) },
|
||||
{ "skip", CreateSkip() },
|
||||
{ "count", CreateCount() },
|
||||
{ "filter", CreateFilter() },
|
||||
|
@ -524,7 +524,7 @@ namespace Microsoft.OpenApi.OData.Generator
|
|||
}
|
||||
|
||||
// #top
|
||||
private static OpenApiParameter CreateTop()
|
||||
private static OpenApiParameter CreateTop(int topExample)
|
||||
{
|
||||
return new OpenApiParameter
|
||||
{
|
||||
|
@ -536,7 +536,7 @@ namespace Microsoft.OpenApi.OData.Generator
|
|||
Type = "integer",
|
||||
Minimum = 0,
|
||||
},
|
||||
Example = new OpenApiInteger(50)
|
||||
Example = new OpenApiInteger(topExample)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,11 @@ namespace Microsoft.OpenApi.OData
|
|||
/// </summary>
|
||||
public bool IEEE754Compatible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets $Top example value.
|
||||
/// </summary>
|
||||
public int TopExample { get; set; } = 50;
|
||||
|
||||
internal OpenApiConvertSettings Clone()
|
||||
{
|
||||
var newSettings = new OpenApiConvertSettings();
|
||||
|
@ -90,6 +95,7 @@ namespace Microsoft.OpenApi.OData
|
|||
newSettings.EnableOperationId = this.EnableOperationId;
|
||||
newSettings.VerifyEdmModel = this.VerifyEdmModel;
|
||||
newSettings.IEEE754Compatible = this.IEEE754Compatible;
|
||||
newSettings.TopExample = this.TopExample;
|
||||
|
||||
return newSettings;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue