Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ protected override void SetResponses(OpenApiOperation operation)
}
else
{
OpenApiSchema schema;
if (EdmOperation.ReturnType.TypeKind() == EdmTypeKind.Collection)
{
// Get the entity type of the previous segment
IEdmEntityType entityType = Path.Segments.Reverse().Skip(1).Take(1).FirstOrDefault().EntityType;
schema = new OpenApiSchema
{
Title = $"Collection of {entityType.Name}",
Type = "object",
Properties = new Dictionary<string, OpenApiSchema>
{
{
"value", Context.CreateEdmTypeSchema(EdmOperation.ReturnType)
}
}
};
}
else
{
schema = Context.CreateEdmTypeSchema(EdmOperation.ReturnType);
}

// function should have a return type.
OpenApiResponse response = new OpenApiResponse
{
Expand All @@ -182,7 +204,7 @@ protected override void SetResponses(OpenApiOperation operation)
Constants.ApplicationJsonMediaType,
new OpenApiMediaType
{
Schema = Context.CreateEdmTypeSchema(EdmOperation.ReturnType)
Schema = schema
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
}
}
}
}
},
Expand Down Expand Up @@ -1221,9 +1227,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down Expand Up @@ -1636,9 +1648,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Trip",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down Expand Up @@ -2814,9 +2832,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
}
}
}
}
},
Expand Down Expand Up @@ -2874,9 +2898,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down Expand Up @@ -3353,9 +3383,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Trip",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down Expand Up @@ -4563,9 +4599,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip"
}
}
}
}
},
Expand Down Expand Up @@ -4623,9 +4665,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Person",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down Expand Up @@ -5102,9 +5150,15 @@
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
"title": "Collection of Trip",
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
}
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down Expand Up @@ -836,9 +840,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: action
Expand Down Expand Up @@ -1127,9 +1135,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Trip
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down Expand Up @@ -1952,9 +1964,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down Expand Up @@ -1993,9 +2009,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: action
Expand Down Expand Up @@ -2332,9 +2352,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Trip
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down Expand Up @@ -3181,9 +3205,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down Expand Up @@ -3222,9 +3250,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Person
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: action
Expand Down Expand Up @@ -3561,9 +3593,13 @@ paths:
'200':
description: Success
schema:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
title: Collection of Trip
type: object
properties:
value:
type: array
items:
$ref: '#/definitions/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
default:
$ref: '#/responses/error'
x-ms-docs-operation-type: function
Expand Down
Loading