- switches to a referenced schema for count operations
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
parent
2fee91b384
commit
76cfc303bc
|
@ -79,5 +79,9 @@ namespace Microsoft.OpenApi.OData.Common
|
|||
/// extension for discriminator value support
|
||||
/// </summary>
|
||||
public static string xMsDiscriminatorValue = "x-ms-discriminator-value";
|
||||
/// <summary>
|
||||
/// Name used for the OpenAPI referenced schema for OData Count operations responses.
|
||||
/// </summary>
|
||||
public static string DollarCountSchemaName = "ODataCountResponse";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,11 @@ namespace Microsoft.OpenApi.OData.Generator
|
|||
schemas[schema.Key] = schema.Value;
|
||||
}
|
||||
|
||||
schemas[Constants.DollarCountSchemaName] = new OpenApiSchema {
|
||||
Type = "integer",
|
||||
Format = "int32"
|
||||
};
|
||||
|
||||
return schemas;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,10 +54,12 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
/// <inheritdoc/>
|
||||
protected override void SetResponses(OpenApiOperation operation)
|
||||
{
|
||||
OpenApiSchema schema = new OpenApiSchema
|
||||
{
|
||||
Type = "integer",
|
||||
Format = "int32"
|
||||
OpenApiSchema schema = new()
|
||||
{
|
||||
Reference = new() {
|
||||
Type = ReferenceType.Schema,
|
||||
Id = Constants.DollarCountSchemaName
|
||||
}
|
||||
};
|
||||
|
||||
operation.Responses = new OpenApiResponses
|
||||
|
|
Loading…
Reference in a new issue