Add support for operation descriptions and update tests
This commit is contained in:
parent
830eb357c7
commit
2b31063f7a
|
@ -45,6 +45,8 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
{
|
||||
operation.Summary = "Invoke " + (EdmOperationImport.IsActionImport() ? "actionImport " : "functionImport ") + EdmOperationImport.Name;
|
||||
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(EdmOperationImport);
|
||||
|
||||
if (Context.Settings.EnableOperationId)
|
||||
{
|
||||
if (EdmOperationImport.IsActionImport())
|
||||
|
|
|
@ -61,6 +61,9 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
// Summary
|
||||
operation.Summary = "Invoke " + (EdmOperation.IsAction() ? "action " : "function ") + EdmOperation.Name;
|
||||
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(EdmOperation);
|
||||
|
||||
// OperationId
|
||||
if (Context.Settings.EnableOperationId)
|
||||
{
|
||||
|
|
|
@ -29,14 +29,17 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
// Summary
|
||||
operation.Summary = "Delete entity from " + EntitySet.Name;
|
||||
|
||||
IEdmEntityType entityType = EntitySet.EntityType();
|
||||
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(entityType);
|
||||
|
||||
// OperationId
|
||||
if (Context.Settings.EnableOperationId)
|
||||
{
|
||||
string typeName = EntitySet.EntityType().Name;
|
||||
string typeName = entityType.Name;
|
||||
operation.OperationId = EntitySet.Name + "." + typeName + ".Delete" + Utils.UpperFirstChar(typeName);
|
||||
}
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
@ -30,14 +30,17 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
// Summary
|
||||
operation.Summary = "Get entity from " + EntitySet.Name + " by key";
|
||||
|
||||
IEdmEntityType entityType = EntitySet.EntityType();
|
||||
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(entityType);
|
||||
|
||||
// OperationId
|
||||
if (Context.Settings.EnableOperationId)
|
||||
{
|
||||
string typeName = EntitySet.EntityType().Name;
|
||||
string typeName = entityType.Name;
|
||||
operation.OperationId = EntitySet.Name + "." + typeName + ".Get" + Utils.UpperFirstChar(typeName);
|
||||
}
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
@ -30,14 +30,17 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
// Summary
|
||||
operation.Summary = "Update entity in " + EntitySet.Name;
|
||||
|
||||
IEdmEntityType entityType = EntitySet.EntityType();
|
||||
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(entityType);
|
||||
|
||||
// OperationId
|
||||
if (Context.Settings.EnableOperationId)
|
||||
{
|
||||
string typeName = EntitySet.EntityType().Name;
|
||||
string typeName = entityType.Name;
|
||||
operation.OperationId = EntitySet.Name + "." + typeName + ".Update" + Utils.UpperFirstChar(typeName);
|
||||
}
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
@ -32,6 +32,15 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
EntitySet = navigationSourceSegment.NavigationSource as IEdmEntitySet;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetBasicInfo(OpenApiOperation operation)
|
||||
{
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(EntitySet);
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetTags(OpenApiOperation operation)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// ------------------------------------------------------------
|
||||
|
||||
using Microsoft.OData.Edm;
|
||||
using Microsoft.OData.Edm.Vocabularies;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.OpenApi.OData.Common;
|
||||
using Microsoft.OpenApi.OData.Edm;
|
||||
|
@ -28,11 +29,20 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
if (IsNavigationPropertyPath)
|
||||
{
|
||||
operation.Summary = $"Get media content for the navigation property {NavigationProperty.Name} from {NavigationSource.Name}";
|
||||
// description = Context.Model.GetDescriptionAnnotation(NavigationProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
string typeName = EntitySet.EntityType().Name;
|
||||
operation.Summary = $"Get media content for {typeName} from {EntitySet.Name}";
|
||||
IEdmEntityType entityType = EntitySet.EntityType();
|
||||
operation.Summary = $"Get media content for {entityType.Name} from {EntitySet.Name}";
|
||||
// description = Context.Model.GetDescriptionAnnotation(entityType);
|
||||
}
|
||||
|
||||
// Description
|
||||
IEdmVocabularyAnnotatable annotatableElement = GetAnnotatableElement();
|
||||
if (annotatableElement != null)
|
||||
{
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(annotatableElement);
|
||||
}
|
||||
|
||||
// OperationId
|
||||
|
@ -41,8 +51,6 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
string identifier = Path.LastSegment.Kind == ODataSegmentKind.StreamContent ? "Content" : Path.LastSegment.Identifier;
|
||||
operation.OperationId = GetOperationId("Get", identifier);
|
||||
}
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
@ -151,28 +151,8 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
Format = "binary"
|
||||
};
|
||||
|
||||
IEdmVocabularyAnnotatable annotatableElement = null;
|
||||
IEdmEntityType entityType = EntitySet != null ? EntitySet.EntityType() : Singleton.EntityType();
|
||||
ODataSegment lastSegmentStreamProp = Path.Segments.LastOrDefault(c => c is ODataStreamPropertySegment);
|
||||
|
||||
if (lastSegmentStreamProp != null)
|
||||
{
|
||||
// Get the annotatable stream property
|
||||
// The stream property can either be a structural type or navigation type property
|
||||
IEdmProperty property = GetStructuralProperty(entityType, lastSegmentStreamProp.Identifier);
|
||||
if (property == null)
|
||||
{
|
||||
property = GetNavigationProperty(entityType, lastSegmentStreamProp.Identifier);
|
||||
}
|
||||
|
||||
annotatableElement = property;
|
||||
}
|
||||
else
|
||||
{
|
||||
annotatableElement = entityType;
|
||||
}
|
||||
|
||||
// Fetch the respective AcceptableMediaTypes
|
||||
IEdmVocabularyAnnotatable annotatableElement = GetAnnotatableElement();
|
||||
IEnumerable<string> mediaTypes = null;
|
||||
if (annotatableElement != null)
|
||||
{
|
||||
|
@ -199,6 +179,39 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
return content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the annotatable element from the segments of a path.
|
||||
/// </summary>
|
||||
/// <returns>The annotable element.</returns>
|
||||
protected IEdmVocabularyAnnotatable GetAnnotatableElement()
|
||||
{
|
||||
IEdmEntityType entityType = EntitySet != null ? EntitySet.EntityType() : Singleton.EntityType();
|
||||
ODataSegment lastSegmentProp = Path.Segments.LastOrDefault(c => c is ODataStreamPropertySegment);
|
||||
|
||||
if (lastSegmentProp == null)
|
||||
{
|
||||
int pathCount = Path.Segments.Count;
|
||||
|
||||
// Retrieve the segment before the stream content segment
|
||||
lastSegmentProp = Path.Segments.ElementAtOrDefault(pathCount - 2);
|
||||
|
||||
if (lastSegmentProp == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the annotatable stream property
|
||||
// The stream property can either be a structural type or navigation type property
|
||||
IEdmProperty property = GetStructuralProperty(entityType, lastSegmentProp.Identifier);
|
||||
if (property == null)
|
||||
{
|
||||
property = GetNavigationProperty(entityType, lastSegmentProp.Identifier);
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
private IEdmStructuralProperty GetStructuralProperty(IEdmEntityType entityType, string identifier)
|
||||
{
|
||||
return entityType.DeclaredStructuralProperties().FirstOrDefault(x => x.Name.Equals(identifier));
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
using System.Linq;
|
||||
using Microsoft.OData.Edm;
|
||||
using Microsoft.OData.Edm.Vocabularies;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.OpenApi.OData.Common;
|
||||
using Microsoft.OpenApi.OData.Edm;
|
||||
|
@ -31,8 +32,15 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
}
|
||||
else
|
||||
{
|
||||
string typeName = EntitySet.EntityType().Name;
|
||||
operation.Summary = $"Update media content for {typeName} in {EntitySet.Name}";
|
||||
IEdmEntityType entityType = EntitySet.EntityType();
|
||||
operation.Summary = $"Update media content for {entityType.Name} in {EntitySet.Name}";
|
||||
}
|
||||
|
||||
// Description
|
||||
IEdmVocabularyAnnotatable annotatableElement = GetAnnotatableElement();
|
||||
if (annotatableElement != null)
|
||||
{
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(annotatableElement);
|
||||
}
|
||||
|
||||
// OperationId
|
||||
|
@ -41,8 +49,6 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
string identifier = Path.LastSegment.Kind == ODataSegmentKind.StreamContent ? "Content" : Path.LastSegment.Identifier;
|
||||
operation.OperationId = GetOperationId("Update", identifier);
|
||||
}
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
@ -84,6 +84,15 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetBasicInfo(OpenApiOperation operation)
|
||||
{
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(NavigationProperty);
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetTags(OpenApiOperation operation)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,15 @@ namespace Microsoft.OpenApi.OData.Operation
|
|||
Singleton = navigationSourceSegment.NavigationSource as IEdmSingleton;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetBasicInfo(OpenApiOperation operation)
|
||||
{
|
||||
// Description
|
||||
operation.Description = Context.Model.GetDescriptionAnnotation(Singleton);
|
||||
|
||||
base.SetBasicInfo(operation);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetTags(OpenApiOperation operation)
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Invoke actionImport ResetDataSource", operation.Summary);
|
||||
Assert.Equal("Resets the data source to default values.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
|
||||
Assert.NotNull(operation.Parameters);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Invoke action ShareTrip", operation.Summary);
|
||||
Assert.Equal("Details of the shared trip.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Actions", tag.Name);
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Invoke functionImport GetPersonWithMostFriends", operation.Summary);
|
||||
Assert.Equal("The person with most friends.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People", tag.Name);
|
||||
|
|
|
@ -74,6 +74,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal($"Invoke function {functionName}", operation.Summary);
|
||||
Assert.Equal("Collection of contract attachments.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal($"{entitySetName}.Functions", tag.Name);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(delete);
|
||||
Assert.Equal("Delete entity from Customers", delete.Summary);
|
||||
Assert.Equal("A business customer.", delete.Description);
|
||||
Assert.NotNull(delete.Tags);
|
||||
var tag = Assert.Single(delete.Tags);
|
||||
Assert.Equal("Customers.Customer", tag.Name);
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(get);
|
||||
Assert.Equal("Get entity from Customers by key", get.Summary);
|
||||
Assert.Equal("A business customer.", get.Description);
|
||||
Assert.NotNull(get.Tags);
|
||||
var tag = Assert.Single(get.Tags);
|
||||
Assert.Equal("Customers.Customer", tag.Name);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(patch);
|
||||
Assert.Equal("Update entity in Customers", patch.Summary);
|
||||
Assert.Equal("A business customer.", patch.Description);
|
||||
Assert.NotNull(patch.Tags);
|
||||
var tag = Assert.Single(patch.Tags);
|
||||
Assert.Equal("Customers.Customer", tag.Name);
|
||||
|
|
|
@ -31,7 +31,8 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
<String>image/png</String>
|
||||
<String>image/jpeg</String>
|
||||
</Collection>
|
||||
</Annotation>";
|
||||
</Annotation>
|
||||
<Annotation Term=""Org.OData.Core.V1.Description"" String=""The logo image."" />";
|
||||
|
||||
// Assert
|
||||
VerifyMediaEntityGetOperation("", enableOperationId);
|
||||
|
@ -74,6 +75,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
Assert.NotNull(getOperation2);
|
||||
Assert.Equal("Get media content for Todo from Todos", getOperation.Summary);
|
||||
Assert.Equal("Get media content for the navigation property photo from me", getOperation2.Summary);
|
||||
Assert.Equal("The user's profile photo.", getOperation2.Description);
|
||||
Assert.NotNull(getOperation.Tags);
|
||||
Assert.NotNull(getOperation2.Tags);
|
||||
|
||||
|
@ -94,6 +96,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
Assert.Equal(2, getOperation.Responses[Constants.StatusCode200].Content.Keys.Count);
|
||||
Assert.True(getOperation.Responses[Constants.StatusCode200].Content.ContainsKey("image/png"));
|
||||
Assert.True(getOperation.Responses[Constants.StatusCode200].Content.ContainsKey("image/jpeg"));
|
||||
Assert.Equal("The logo image.", getOperation.Description);
|
||||
|
||||
Assert.Equal(1, getOperation2.Responses[Constants.StatusCode200].Content.Keys.Count);
|
||||
Assert.True(getOperation2.Responses[Constants.StatusCode200].Content.ContainsKey(Constants.ApplicationOctetStreamMediaType));
|
||||
|
@ -132,7 +135,9 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
<Property Name = ""Description"" Type = ""Edm.String"" />
|
||||
</EntityType>
|
||||
<EntityType Name=""user"" OpenType=""true"">
|
||||
<NavigationProperty Name = ""photo"" Type = ""microsoft.graph.profilePhoto"" ContainsTarget = ""true"" />
|
||||
<NavigationProperty Name = ""photo"" Type = ""microsoft.graph.profilePhoto"" ContainsTarget = ""true"" >
|
||||
<Annotation Term=""Org.OData.Core.V1.Description"" String=""The user's profile photo."" />
|
||||
</NavigationProperty>
|
||||
</EntityType>
|
||||
<EntityType Name=""profilePhoto"" HasStream=""true"">
|
||||
<Property Name = ""height"" Type = ""Edm.Int32"" />
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
<String>image/png</String>
|
||||
<String>image/jpeg</String>
|
||||
</Collection>
|
||||
</Annotation>";
|
||||
</Annotation>
|
||||
<Annotation Term=""Org.OData.Core.V1.Description"" String=""The logo image."" />";
|
||||
|
||||
// Assert
|
||||
VerifyMediaEntityPutOperation("", enableOperationId);
|
||||
|
@ -71,6 +72,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
Assert.NotNull(putOperation2);
|
||||
Assert.Equal("Update media content for Todo in Todos", putOperation.Summary);
|
||||
Assert.Equal("Update media content for the navigation property photo in me", putOperation2.Summary);
|
||||
Assert.Equal("The user's profile photo.", putOperation2.Description);
|
||||
Assert.NotNull(putOperation.Tags);
|
||||
Assert.NotNull(putOperation2.Tags);
|
||||
|
||||
|
@ -91,6 +93,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
Assert.Equal(2, putOperation.RequestBody.Content.Keys.Count);
|
||||
Assert.True(putOperation.RequestBody.Content.ContainsKey("image/png"));
|
||||
Assert.True(putOperation.RequestBody.Content.ContainsKey("image/jpeg"));
|
||||
Assert.Equal("The logo image.", putOperation.Description);
|
||||
|
||||
Assert.Equal(1, putOperation2.RequestBody.Content.Keys.Count);
|
||||
Assert.True(putOperation2.RequestBody.Content.ContainsKey(Constants.ApplicationOctetStreamMediaType));
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Delete navigation property Trips for People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Get Trips from People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Update the navigation property BestFriend in People", operation.Summary);
|
||||
Assert.Equal("The best friend.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Person", tag.Name);
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Create new navigation property to Trips for People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Delete ref of navigation property Trips for People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Get ref of Trips from People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Create new navigation property ref to Trips for People", operation.Summary);
|
||||
Assert.Equal("Collection of trips.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Trip", tag.Name);
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(operation);
|
||||
Assert.Equal("Update the ref of navigation property BestFriend in People", operation.Summary);
|
||||
Assert.Equal("The best friend.", operation.Description);
|
||||
Assert.NotNull(operation.Tags);
|
||||
var tag = Assert.Single(operation.Tags);
|
||||
Assert.Equal("People.Person", tag.Name);
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
// Assert
|
||||
Assert.NotNull(get);
|
||||
Assert.Equal("Get Me", get.Summary);
|
||||
Assert.Equal("My signed-in instance.", get.Description);
|
||||
Assert.NotNull(get.Tags);
|
||||
var tag = Assert.Single(get.Tags);
|
||||
Assert.Equal("Me.Customer", tag.Name);
|
||||
|
@ -249,7 +250,9 @@ namespace Microsoft.OpenApi.OData.Operation.Tests
|
|||
<Property Name=""ID"" Type=""Edm.Int32"" Nullable=""false"" />
|
||||
</EntityType>
|
||||
<EntityContainer Name =""Default"">
|
||||
<Singleton Name=""Me"" Type=""NS.Customer"" />
|
||||
<Singleton Name=""Me"" Type=""NS.Customer"">
|
||||
<Annotation Term=""Org.OData.Core.V1.Description"" String=""My signed-in instance."" />
|
||||
</Singleton>
|
||||
</EntityContainer>
|
||||
<Annotations Target=""NS.Default/Me"">
|
||||
{0}
|
||||
|
|
|
@ -599,6 +599,7 @@
|
|||
"People.Person"
|
||||
],
|
||||
"summary": "Get entities from People",
|
||||
"description": "People's description.",
|
||||
"operationId": "People.Person.ListPerson",
|
||||
"produces": [
|
||||
"application/json"
|
||||
|
@ -692,6 +693,7 @@
|
|||
"People.Person"
|
||||
],
|
||||
"summary": "Add new entity to People",
|
||||
"description": "People's description.",
|
||||
"operationId": "People.Person.CreatePerson",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
|
|
|
@ -394,6 +394,7 @@ paths:
|
|||
tags:
|
||||
- People.Person
|
||||
summary: Get entities from People
|
||||
description: People's description.
|
||||
operationId: People.Person.ListPerson
|
||||
produces:
|
||||
- application/json
|
||||
|
@ -454,6 +455,7 @@ paths:
|
|||
tags:
|
||||
- People.Person
|
||||
summary: Add new entity to People
|
||||
description: People's description.
|
||||
operationId: People.Person.CreatePerson
|
||||
consumes:
|
||||
- application/json
|
||||
|
|
|
@ -672,6 +672,7 @@
|
|||
"People.Person"
|
||||
],
|
||||
"summary": "Get entities from People",
|
||||
"description": "People's description.",
|
||||
"operationId": "People.Person.ListPerson",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -781,6 +782,7 @@
|
|||
"People.Person"
|
||||
],
|
||||
"summary": "Add new entity to People",
|
||||
"description": "People's description.",
|
||||
"operationId": "People.Person.CreatePerson",
|
||||
"requestBody": {
|
||||
"description": "New entity",
|
||||
|
|
|
@ -441,6 +441,7 @@ paths:
|
|||
tags:
|
||||
- People.Person
|
||||
summary: Get entities from People
|
||||
description: People's description.
|
||||
operationId: People.Person.ListPerson
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/top'
|
||||
|
@ -513,6 +514,7 @@ paths:
|
|||
tags:
|
||||
- People.Person
|
||||
summary: Add new entity to People
|
||||
description: People's description.
|
||||
operationId: People.Person.CreatePerson
|
||||
requestBody:
|
||||
description: New entity
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<Property Name="size" Type="Edm.Int64" />
|
||||
<Property Name="type" Type="Edm.String" />
|
||||
<Property Name="date" Type="Edm.DateTimeOffset" />
|
||||
<Property Name="comment" Type="Edm.String" />
|
||||
<Property Name="comment" Type="Edm.String" />
|
||||
</ComplexType>
|
||||
<EntityType Name="AccountApiModel" BaseType="Microsoft.OData.Service.Sample.Contract.BaseEntityApiModel">
|
||||
<Property Name="priority" Type="Edm.Int32" />
|
||||
|
@ -31,6 +31,7 @@
|
|||
</Schema>
|
||||
<Schema Namespace="Default" xmlns="http://docs.oasis-open.org/odata/ns/edm">
|
||||
<Function Name="Attachments" IsBound="true">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="Collection of contract attachments." />
|
||||
<Parameter Name="bindingParameter" Type="Microsoft.OData.Service.Sample.Contract.BaseEntityApiModel" />
|
||||
<ReturnType Type="Collection(Microsoft.OData.Service.Sample.Contract.AttachmentApiModel)" />
|
||||
</Function>
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
<Property Name="FavoriteFeature" Type="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Feature" Nullable="false" />
|
||||
<Property Name="Features" Type="Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Feature)" Nullable="false" />
|
||||
<NavigationProperty Name="Friends" Type="Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person)" />
|
||||
<NavigationProperty Name="BestFriend" Type="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" />
|
||||
<NavigationProperty Name="Trips" Type="Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip)" ContainsTarget="true"/>
|
||||
<NavigationProperty Name="BestFriend" Type="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="The best friend." />
|
||||
</NavigationProperty>
|
||||
<NavigationProperty Name="Trips" Type="Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip)" ContainsTarget="true">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="Collection of trips." />
|
||||
</NavigationProperty>
|
||||
</EntityType>
|
||||
<EntityType Name="Airline">
|
||||
<Key>
|
||||
|
@ -137,6 +141,7 @@
|
|||
<ReturnType Type="Edm.Boolean" Nullable="false" />
|
||||
</Function>
|
||||
<Action Name="ShareTrip" IsBound="true">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="Details of the shared trip." />
|
||||
<Parameter Name="personInstance" Type="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" />
|
||||
<Parameter Name="userName" Type="Edm.String" Nullable="false" Unicode="false" />
|
||||
<Parameter Name="tripId" Type="Edm.Int32" Nullable="false" />
|
||||
|
@ -164,9 +169,13 @@
|
|||
<EntitySet Name="Airports" EntityType="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport" />
|
||||
<EntitySet Name="NewComePeople" EntityType="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" />
|
||||
<Singleton Name="Me" Type="Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person" />
|
||||
<FunctionImport Name="GetPersonWithMostFriends" Function="Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetPersonWithMostFriends" EntitySet="People" />
|
||||
<FunctionImport Name="GetPersonWithMostFriends" Function="Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetPersonWithMostFriends" EntitySet="People">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="The person with most friends." />
|
||||
</FunctionImport>
|
||||
<FunctionImport Name="GetNearestAirport" Function="Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetNearestAirport" EntitySet="Airports" />
|
||||
<ActionImport Name="ResetDataSource" Action="Microsoft.OData.Service.Sample.TrippinInMemory.Models.ResetDataSource" />
|
||||
<ActionImport Name="ResetDataSource" Action="Microsoft.OData.Service.Sample.TrippinInMemory.Models.ResetDataSource">
|
||||
<Annotation Term="Org.OData.Core.V1.Description" String="Resets the data source to default values." />
|
||||
</ActionImport>
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:DataServices>
|
||||
|
|
Loading…
Reference in a new issue