Modify the path related codes

This commit is contained in:
Sam Xu 2018-09-17 13:07:07 -07:00
parent be14a752d3
commit cecf114328
11 changed files with 1020 additions and 1097 deletions

View file

@ -16,6 +16,11 @@ namespace Microsoft.OpenApi.OData.Edm
/// </summary>
public static class EdmModelExtensions
{
/// <summary>
/// Load all navigation sources into a dictionary.
/// </summary>
/// <param name="model">The Edm model.</param>
/// <returns>The dictionary.</returns>
public static IDictionary<IEdmEntityType, IList<IEdmNavigationSource>> LoadAllNavigationSources(this IEdmModel model)
{
var navigationSourceDic = new Dictionary<IEdmEntityType, IList<IEdmNavigationSource>>();
@ -32,11 +37,13 @@ namespace Microsoft.OpenApi.OData.Edm
value.Add(ns);
};
// entity-set
foreach (var entitySet in model.EntityContainer.EntitySets())
{
action(entitySet, navigationSourceDic);
}
// singleton
foreach (var singelton in model.EntityContainer.Singletons())
{
action(singelton, navigationSourceDic);
@ -46,6 +53,11 @@ namespace Microsoft.OpenApi.OData.Edm
return navigationSourceDic;
}
/// <summary>
/// Find all base types for a given <see cref="IEdmEntityType"/>
/// </summary>
/// <param name="entityType">The given entity type.</param>
/// <returns>All base types or null.</returns>
public static IEnumerable<IEdmEntityType> FindAllBaseTypes(this IEdmEntityType entityType)
{
if (entityType == null)

View file

@ -193,11 +193,7 @@ namespace Microsoft.OpenApi.OData.Edm
private ODataPathKind CalcPathType()
{
if (Segments.Any(c => c.Kind == ODataSegmentKind.NavigationProperty))
{
return ODataPathKind.NavigationProperty;
}
else if (Segments.Any(c => c.Kind == ODataSegmentKind.OperationImport))
if (Segments.Any(c => c.Kind == ODataSegmentKind.OperationImport))
{
return ODataPathKind.OperationImport;
}
@ -205,6 +201,10 @@ namespace Microsoft.OpenApi.OData.Edm
{
return ODataPathKind.Operation;
}
else if (Segments.Any(c => c.Kind == ODataSegmentKind.NavigationProperty))
{
return ODataPathKind.NavigationProperty;
}
if (Segments.Count == 1)
{

View file

@ -1,410 +0,0 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.OData.Edm;
using Microsoft.OpenApi.OData.Common;
namespace Microsoft.OpenApi.OData.Edm
{
/// <summary>
/// Helper class for <see cref="ODataPath"/> generating.
/// </summary>
internal class ODataPathHandler
{
private IList<ODataPath> _paths = null;
/// <summary>
/// Gets the OData Context
/// </summary>
public ODataContext Context { get; }
/// <summary>
/// Gets the <see cref="ODataPath"/>s.
/// </summary>
public IList<ODataPath> Paths => GeneratePaths();
/// <summary>
/// Initializes a new instance of <see cref="ODataPathHandler"/> class.
/// </summary>
/// <param name="context">The OData context.</param>
public ODataPathHandler(ODataContext context)
{
Context = context ?? throw Error.ArgumentNull(nameof(context));
}
/// <summary>
/// Generate the <see cref="ODataPath"/> from <see cref="IEdmModel"/> and <see cref="OpenApiConvertSettings"/>.
/// </summary>
/// <returns>The generated paths.</returns>
private IList<ODataPath> GeneratePaths()
{
if (_paths != null)
{
return _paths;
}
_paths = new List<ODataPath>();
if (Context.Model.EntityContainer == null)
{
return _paths;
}
// entity set
foreach (IEdmEntitySet entitySet in Context.Model.EntityContainer.EntitySets())
{
RetrieveNavigationSourcePaths(entitySet);
if (Context.Settings.EnableOperationPath)
{
// RetrieveOperationPaths(entitySet);
}
}
// singleton
foreach (IEdmSingleton singleton in Context.Model.EntityContainer.Singletons())
{
RetrieveNavigationSourcePaths(singleton);
if (Context.Settings.EnableOperationPath)
{
// RetrieveOperationPaths(singleton);
}
}
if (Context.Settings.EnableOperationPath)
{
ProcessOperations();
}
// operation import
if (Context.Settings.EnableOperationImportPath)
{
foreach (IEdmOperationImport import in Context.Model.EntityContainer.OperationImports())
{
_paths.Add(new ODataPath(new ODataOperationImportSegment(import)));
}
}
return _paths;
}
/// <summary>
/// Retrieve the path for <see cref="IEdmNavigationSource"/>.
/// </summary>
/// <param name="navigationSource">The navigation source.</param>
private void RetrieveNavigationSourcePaths(IEdmNavigationSource navigationSource)
{
Debug.Assert(navigationSource != null);
// navigation source itself
ODataPath path = new ODataPath();
path.Push(new ODataNavigationSourceSegment(navigationSource));
_paths.Add(path.Clone());
IEdmEntitySet entitySet = navigationSource as IEdmEntitySet;
IEdmEntityType entityType = navigationSource.EntityType();
// for entity set, create a path with key
if (entitySet != null)
{
path.Push(new ODataKeySegment(entityType));
_paths.Add(path.Clone());
}
// navigation property
if (Context.Settings.EnableNavigationPropertyPath)
{
foreach (IEdmNavigationProperty np in entityType.DeclaredNavigationProperties())
{
RetrieveNavigationPropertyPaths(np, path);
}
}
if (entitySet != null)
{
path.Pop(); // end of entity
}
path.Pop(); // end of navigation source.
Debug.Assert(path.Any() == false);
}
/// <summary>
/// Retrieve the path for <see cref="IEdmNavigationProperty"/>.
/// </summary>
/// <param name="navigationProperty">The navigation property.</param>
/// <param name="currentPath">The current OData path.</param>
private void RetrieveNavigationPropertyPaths(IEdmNavigationProperty navigationProperty, ODataPath currentPath)
{
Debug.Assert(navigationProperty != null);
Debug.Assert(currentPath != null);
int count = currentPath.GetCount(Context.Settings.CountKeySegmentAsDepth);
if (count > Context.Settings.NavigationPropertyDepth)
{
return;
}
bool shouldExpand = ShouldExpandNavigationProperty(navigationProperty, currentPath);
// append a navigation property.
currentPath.Push(new ODataNavigationPropertySegment(navigationProperty));
_paths.Add(currentPath.Clone());
// append a navigation property key.
IEdmEntityType navEntityType = navigationProperty.ToEntityType();
if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many)
{
currentPath.Push(new ODataKeySegment(navEntityType));
_paths.Add(currentPath.Clone());
}
if (shouldExpand)
{
foreach (IEdmNavigationProperty subNavProperty in navEntityType.DeclaredNavigationProperties())
{
RetrieveNavigationPropertyPaths(subNavProperty, currentPath);
}
}
if (navigationProperty.TargetMultiplicity() == EdmMultiplicity.Many)
{
currentPath.Pop();
}
currentPath.Pop();
}
/// <summary>
/// Retrieve the <see cref="IEdmOperation"/> path for <see cref="IEdmNavigationSource"/>.
/// </summary>
/// <param name="navigationSource">The navigation source.</param>
private void RetrieveOperationPaths(IEdmNavigationSource navigationSource)
{
Debug.Assert(navigationSource != null);
IEnumerable<Tuple<IEdmEntityType, IEdmOperation>> operations;
IEdmEntitySet entitySet = navigationSource as IEdmEntitySet;
ODataPath path = new ODataPath(new ODataNavigationSourceSegment(navigationSource));
if (entitySet != null)
{
operations = Context.FindOperations(navigationSource.EntityType(), collection: true);
foreach (var operation in operations)
{
// Append the type cast
if (!operation.Item1.IsEquivalentTo(navigationSource.EntityType()))
{
path.Push(new ODataTypeCastSegment(operation.Item1));
path.Push(new ODataOperationSegment(operation.Item2));
_paths.Add(path.Clone());
path.Pop();
path.Pop();
}
else
{
path.Push(new ODataOperationSegment(operation.Item2));
_paths.Add(path.Clone());
path.Pop();
}
}
}
// for single
if (entitySet != null)
{
path.Push(new ODataKeySegment(navigationSource.EntityType()));
}
operations = Context.FindOperations(navigationSource.EntityType(), collection: false);
foreach (var operation in operations)
{
// Append the type cast
if (!operation.Item1.IsEquivalentTo(navigationSource.EntityType()))
{
path.Push(new ODataTypeCastSegment(operation.Item1));
path.Push(new ODataOperationSegment(operation.Item2));
_paths.Add(path.Clone());
path.Pop();
path.Pop();
}
else
{
path.Push(new ODataOperationSegment(operation.Item2));
_paths.Add(path.Clone());
path.Pop();
}
}
if (entitySet != null)
{
path.Pop();
}
path.Pop();
Debug.Assert(path.Any() == false);
}
private static bool ShouldExpandNavigationProperty(IEdmNavigationProperty navigationProperty, ODataPath currentPath)
{
if (!navigationProperty.ContainsTarget)
{
return false;
}
IEdmEntityType navEntityType = navigationProperty.ToEntityType();
foreach (ODataSegment segment in currentPath)
{
if (navEntityType.IsAssignableFrom(segment.EntityType))
{
return false;
}
}
return true;
}
private void ProcessOperations()
{
IEdmModel model = Context.Model;
var navigationSourceDic = model.EntityContainer.EntitySets().ToDictionary(o => o.EntityType(), o => o as IEdmNavigationSource);
foreach (var edmOperation in model.SchemaElements.OfType<IEdmOperation>().Where(e => e.IsBound))
{
IEdmOperationParameter bindingParameter = edmOperation.Parameters.First();
IEdmTypeReference bindingType = bindingParameter.Type;
bool isCollection = bindingType.IsCollection();
if (isCollection)
{
bindingType = bindingType.AsCollection().ElementType();
}
if (!bindingType.IsEntity())
{
continue;
}
IEdmEntityType bindingEntityType = bindingType.AsEntity().EntityDefinition();
bool found = false;
// 1. Search for correspoinding navigation source
var correspondingNavigationSource = FindNavigationSource(bindingEntityType);
if (correspondingNavigationSource.Any())
{
foreach(var ns in correspondingNavigationSource)
{
if (isCollection)
{
if (ns is IEdmEntitySet)
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
}
else
{
if (ns is IEdmSingleton)
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
else
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataKeySegment(ns.EntityType()),
new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
}
}
}
if (found)
{
continue;
}
// 2. Search for generated navigation property
IList<ODataPath> npPaths = _paths.Where(p => p.Kind == ODataPathKind.NavigationProperty).ToList();
foreach(var path in npPaths)
{
ODataNavigationPropertySegment npSegment = path.Segments.Last(s => s is ODataNavigationPropertySegment) as ODataNavigationPropertySegment;
IEdmEntityType navPropertyEntityType = npSegment.NavigationProperty.ToEntityType();
if (navPropertyEntityType != bindingEntityType)
{
continue;
}
bool isLastKeySegment = path.LastSegment is ODataKeySegment;
if ((isCollection && !isLastKeySegment) || (!isCollection && isLastKeySegment))
{
ODataPath newPath = path.Clone();
newPath.Push(new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
}
if (found)
{
continue;
}
// 3. Search for derived
foreach(var baseType in bindingEntityType.FindAllBaseTypes())
{
var baseNavigationSource = FindNavigationSource(baseType);
if (baseNavigationSource.Any())
{
foreach (var ns in baseNavigationSource)
{
if (isCollection)
{
if (ns is IEdmEntitySet)
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataTypeCastSegment(bindingEntityType),
new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
}
else
{
if (ns is IEdmSingleton)
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataTypeCastSegment(bindingEntityType), new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
else
{
ODataPath newPath = new ODataPath(new ODataNavigationSourceSegment(ns), new ODataKeySegment(ns.EntityType()), new ODataTypeCastSegment(bindingEntityType),
new ODataOperationSegment(edmOperation));
_paths.Add(newPath);
found = true;
}
}
}
}
}
}
}
private IEnumerable<IEdmNavigationSource> FindNavigationSource(IEdmEntityType entityType)
{
IEnumerable<IEdmNavigationSource> returnEnumerable1 = Context.Model.EntityContainer.EntitySets().Where(e => e.EntityType() == entityType);
IEnumerable<IEdmNavigationSource> returnEnumerable2 = Context.Model.EntityContainer.Singletons().Where(e => e.EntityType() == entityType);
return returnEnumerable1.Concat(returnEnumerable2);
}
}
}

View file

@ -25,7 +25,7 @@ namespace Microsoft.OpenApi.OData.Edm
public IEdmModel Model { get; }
/// <summary>
/// Initializes a new instance of <see cref="AuthorizationProvider"/> class.
/// Initializes a new instance of <see cref="ODataPathProvider"/> class.
/// </summary>
/// <param name="model">The Edm model.</param>
public ODataPathProvider(IEdmModel model)
@ -89,7 +89,7 @@ namespace Microsoft.OpenApi.OData.Edm
// navigation source itself
ODataPath path = new ODataPath(new ODataNavigationSourceSegment(navigationSource));
_allODataPaths.Add(path);
_allODataPaths.Add(path.Clone());
IEdmEntitySet entitySet = navigationSource as IEdmEntitySet;
IEdmEntityType entityType = navigationSource.EntityType();

View file

@ -8,13 +8,39 @@ using Microsoft.OData.Edm;
namespace Microsoft.OpenApi.OData.Edm
{
/// <summary>
/// Segment kind.
/// </summary>
public enum ODataSegmentKind
{
/// <summary>
/// Navigation source (entity set or singleton )
/// </summary>
NavigationSource,
/// <summary>
/// Navigation property
/// </summary>
NavigationProperty,
/// <summary>
/// Edm bound operation (function or action)
/// </summary>
Operation,
/// <summary>
/// Edm unbound operation (function import or action import)
/// </summary>
OperationImport,
/// <summary>
/// Key
/// </summary>
Key,
/// <summary>
/// Type cast
/// </summary>
TypeCast
}
@ -37,7 +63,7 @@ namespace Microsoft.OpenApi.OData.Edm
/// Gets the path item name for this segment.
/// </summary>
/// <param name="settings">The settings.</param>
/// <returns></returns>
/// <returns>The path item name.</returns>
public abstract string GetPathItemName(OpenApiConvertSettings settings);
}
}

View file

@ -33,7 +33,19 @@ namespace Microsoft.OpenApi.OData.Generator
foreach (ODataPath path in context.Paths)
{
if ((path.Kind == ODataPathKind.Operation && !context.Settings.EnableOperationPath) ||
(path.Kind == ODataPathKind.OperationImport && !context.Settings.EnableOperationImportPath) ||
(path.Kind == ODataPathKind.NavigationProperty && !context.Settings.EnableNavigationPropertyPath))
{
continue;
}
IPathItemHandler handler = context.PathItemHanderProvider.GetHandler(path.Kind);
if (handler == null)
{
continue;
}
pathItems.Add(path.GetPathItemName(context.Settings), handler.CreatePathItem(context, path));
}

View file

@ -3,13 +3,13 @@
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
using System.Collections.Generic;
using System.Linq;
using Microsoft.OData.Edm;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.OData.Common;
using Microsoft.OpenApi.OData.Edm;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.OpenApi.OData.PathItem
{

View file

@ -32,6 +32,9 @@ namespace Microsoft.OpenApi.OData.PathItem
// Edm OperationImport
{ ODataPathKind.OperationImport, new OperationImportPathItemHandler() },
// Edm OperationImport
{ ODataPathKind.Unknown, null },
};
/// <inheritdoc/>

View file

@ -4,41 +4,50 @@
// ------------------------------------------------------------
using System;
using System.Linq;
using Microsoft.OData.Edm;
using Microsoft.OpenApi.OData.Properties;
using Microsoft.OpenApi.OData.Tests;
using Xunit;
namespace Microsoft.OpenApi.OData.Edm.Tests
{
public class ODataPathHandlerTests
{
[Fact]
public void ODataPathConstructorThrowsArgumentNull1()
{
IEdmModel model = EdmModelHelper.GraphBetaModel;
ODataContext context = new ODataContext(model);
var handler = new ODataPathHandler(context);
var paths = handler.Paths;
Assert.NotNull(paths);
}
}
public class ODataPathProviderTests
{
[Fact]
public void ODataPathConstructorThrowsArgumentNull123()
public void CtorThrowArgumentNullModel()
{
IEdmModel model = EdmModelHelper.GraphBetaModel;
//ODataContext context = new ODataContext(model);
// Arrange & Act & Assert
Assert.Throws<ArgumentNullException>("model", () => new ODataPathProvider(model: null));
}
[Fact]
public void CreatePathsForEmptyEdmModelReturnsEmptyPaths()
{
// Arrange
IEdmModel model = new EdmModel();
ODataPathProvider provider = new ODataPathProvider(model);
// Act
var paths = provider.CreatePaths();
// Assert
Assert.NotNull(paths);
Assert.Empty(paths);
}
[Fact]
public void CreatePathsForGraphBetaModelReturnsAllPaths()
{
// Arrange
IEdmModel model = EdmModelHelper.GraphBetaModel;
ODataPathProvider provider = new ODataPathProvider(model);
// Act
var paths = provider.CreatePaths();
// Assert
Assert.NotNull(paths);
Assert.Equal(3779, paths.Count());
}
}
}

View file

@ -615,130 +615,6 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFavoriteAirline()':
get:
tags:
- People.Functions
summary: Invoke function GetFavoriteAirline
operationId: People.Person.GetFavoriteAirline.1c526eb64c7a82083ebab0f2
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
responses:
'200':
description: Success
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFriendsTrips(userName={userName})':
get:
tags:
- People.Functions
summary: Invoke function GetFriendsTrips
operationId: People.Person.GetFriendsTrips.9b42e09ab8ef6d73b88be6e9
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: userName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.UpdatePersonLastName(lastName={lastName})':
get:
tags:
- People.Functions
summary: Invoke function UpdatePersonLastName
operationId: People.Person.UpdatePersonLastName.e4ea38792d2cfa3aa5bab91b
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: lastName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: boolean
default: false
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.ShareTrip':
post:
tags:
- People.Actions
summary: Invoke action ShareTrip
operationId: People.Person.ShareTrip
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
requestBody:
description: Action parameters
content:
application/json:
schema:
type: object
properties:
userName:
type: string
tripId:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
required: true
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: action
/Airlines:
get:
tags:
@ -1714,130 +1590,6 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFavoriteAirline()':
get:
tags:
- NewComePeople.Functions
summary: Invoke function GetFavoriteAirline
operationId: NewComePeople.Person.GetFavoriteAirline.1c526eb64c7a82083ebab0f2
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
responses:
'200':
description: Success
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFriendsTrips(userName={userName})':
get:
tags:
- NewComePeople.Functions
summary: Invoke function GetFriendsTrips
operationId: NewComePeople.Person.GetFriendsTrips.9b42e09ab8ef6d73b88be6e9
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: userName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.UpdatePersonLastName(lastName={lastName})':
get:
tags:
- NewComePeople.Functions
summary: Invoke function UpdatePersonLastName
operationId: NewComePeople.Person.UpdatePersonLastName.e4ea38792d2cfa3aa5bab91b
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: lastName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: boolean
default: false
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.ShareTrip':
post:
tags:
- NewComePeople.Actions
summary: Invoke action ShareTrip
operationId: NewComePeople.Person.ShareTrip
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
requestBody:
description: Action parameters
content:
application/json:
schema:
type: object
properties:
userName:
type: string
tripId:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
required: true
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: action
/Me:
get:
tags:
@ -2243,6 +1995,58 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFavoriteAirline()':
get:
tags:
- People.Functions
summary: Invoke function GetFavoriteAirline
operationId: People.Person.GetFavoriteAirline.1c526eb64c7a82083ebab0f2
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
responses:
'200':
description: Success
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFavoriteAirline()':
get:
tags:
- NewComePeople.Functions
summary: Invoke function GetFavoriteAirline
operationId: NewComePeople.Person.GetFavoriteAirline.1c526eb64c7a82083ebab0f2
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
responses:
'200':
description: Success
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
/Me/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFavoriteAirline():
get:
tags:
@ -2261,6 +2065,72 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFriendsTrips(userName={userName})':
get:
tags:
- People.Functions
summary: Invoke function GetFriendsTrips
operationId: People.Person.GetFriendsTrips.9b42e09ab8ef6d73b88be6e9
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: userName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFriendsTrips(userName={userName})':
get:
tags:
- NewComePeople.Functions
summary: Invoke function GetFriendsTrips
operationId: NewComePeople.Person.GetFriendsTrips.9b42e09ab8ef6d73b88be6e9
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: userName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/Me/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetFriendsTrips(userName={userName})':
get:
tags:
@ -2287,6 +2157,173 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Trips/{TripId}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetInvolvedPeople()':
get:
tags:
- People.Functions
summary: Invoke function GetInvolvedPeople
operationId: People.Person.GetInvolvedPeople.27c6c87f0d461b76c8ef1716
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: TripId
in: path
description: 'key: TripId'
required: true
schema:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
x-ms-docs-key-type: Trip
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Trips/{TripId}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetInvolvedPeople()':
get:
tags:
- NewComePeople.Functions
summary: Invoke function GetInvolvedPeople
operationId: NewComePeople.Person.GetInvolvedPeople.27c6c87f0d461b76c8ef1716
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: TripId
in: path
description: 'key: TripId'
required: true
schema:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
x-ms-docs-key-type: Trip
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/Me/Trips/{TripId}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.GetInvolvedPeople()':
get:
tags:
- Me.Functions
summary: Invoke function GetInvolvedPeople
operationId: Me.Person.GetInvolvedPeople.27c6c87f0d461b76c8ef1716
parameters:
- name: TripId
in: path
description: 'key: TripId'
required: true
schema:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
x-ms-docs-key-type: Trip
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.UpdatePersonLastName(lastName={lastName})':
get:
tags:
- People.Functions
summary: Invoke function UpdatePersonLastName
operationId: People.Person.UpdatePersonLastName.e4ea38792d2cfa3aa5bab91b
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: lastName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: boolean
default: false
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.UpdatePersonLastName(lastName={lastName})':
get:
tags:
- NewComePeople.Functions
summary: Invoke function UpdatePersonLastName
operationId: NewComePeople.Person.UpdatePersonLastName.e4ea38792d2cfa3aa5bab91b
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
- name: lastName
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: boolean
default: false
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/Me/Microsoft.OData.Service.Sample.TrippinInMemory.Models.UpdatePersonLastName(lastName={lastName})':
get:
tags:
@ -2310,6 +2347,76 @@ paths:
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: function
'/People/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.ShareTrip':
post:
tags:
- People.Actions
summary: Invoke action ShareTrip
operationId: People.Person.ShareTrip
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
requestBody:
description: Action parameters
content:
application/json:
schema:
type: object
properties:
userName:
type: string
tripId:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
required: true
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: action
'/NewComePeople/{UserName}/Microsoft.OData.Service.Sample.TrippinInMemory.Models.ShareTrip':
post:
tags:
- NewComePeople.Actions
summary: Invoke action ShareTrip
operationId: NewComePeople.Person.ShareTrip
parameters:
- name: UserName
in: path
description: 'key: UserName'
required: true
schema:
type: string
x-ms-docs-key-type: Person
requestBody:
description: Action parameters
content:
application/json:
schema:
type: object
properties:
userName:
type: string
tripId:
maximum: 2147483647
minimum: -2147483648
type: integer
format: int32
required: true
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: action
/Me/Microsoft.OData.Service.Sample.TrippinInMemory.Models.ShareTrip:
post:
tags:
@ -3070,10 +3177,6 @@ tags:
x-ms-docs-toc-type: page
- name: People.Trip
x-ms-docs-toc-type: page
- name: People.Functions
x-ms-docs-toc-type: container
- name: People.Actions
x-ms-docs-toc-type: container
- name: Airlines.Airline
x-ms-docs-toc-type: page
- name: Airports.Airport
@ -3082,16 +3185,20 @@ tags:
x-ms-docs-toc-type: page
- name: NewComePeople.Trip
x-ms-docs-toc-type: page
- name: NewComePeople.Functions
x-ms-docs-toc-type: container
- name: NewComePeople.Actions
x-ms-docs-toc-type: container
- name: Me.Person
x-ms-docs-toc-type: page
- name: Me.Trip
x-ms-docs-toc-type: page
- name: People.Functions
x-ms-docs-toc-type: container
- name: NewComePeople.Functions
x-ms-docs-toc-type: container
- name: Me.Functions
x-ms-docs-toc-type: container
- name: People.Actions
x-ms-docs-toc-type: container
- name: NewComePeople.Actions
x-ms-docs-toc-type: container
- name: Me.Actions
x-ms-docs-toc-type: container
- name: People