Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
42d20b3f0d |
|
@ -3,7 +3,9 @@
|
||||||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
|
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.OData.Edm;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Microsoft.OpenApi.OData.Common;
|
using Microsoft.OpenApi.OData.Common;
|
||||||
using Microsoft.OpenApi.OData.Edm;
|
using Microsoft.OpenApi.OData.Edm;
|
||||||
|
@ -44,7 +46,35 @@ namespace Microsoft.OpenApi.OData.Generator
|
||||||
pathItems.Add(path.GetPathItemName(settings), handler.CreatePathItem(context, path));
|
pathItems.Add(path.GetPathItemName(settings), handler.CreatePathItem(context, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rootPath = new OpenApiPathItem()
|
||||||
|
{
|
||||||
|
Operations = new Dictionary<OperationType, OpenApiOperation> {
|
||||||
|
{ OperationType.Get, new OpenApiOperation {
|
||||||
|
Responses = new OpenApiResponses()
|
||||||
|
{
|
||||||
|
{ "200",new OpenApiResponse() {
|
||||||
|
Description = "OK",
|
||||||
|
Links = CreateRootLinks(context.EntityContainer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
pathItems.Add("/", rootPath);
|
||||||
|
|
||||||
return pathItems;
|
return pathItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IDictionary<string, OpenApiLink> CreateRootLinks(IEdmEntityContainer entityContainer)
|
||||||
|
{
|
||||||
|
var links = new Dictionary<string, OpenApiLink>();
|
||||||
|
foreach(var element in entityContainer.Elements)
|
||||||
|
{
|
||||||
|
links.Add(element.Name, new OpenApiLink());
|
||||||
|
}
|
||||||
|
return links;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
|
|
Loading…
Reference in a new issue