From 32069a0ad9b00c3019153448964693a2ba5dac95 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 19 Nov 2021 10:54:23 -0500 Subject: [PATCH] - upgrades update docs tool to net5 and removes net 5 copy --- tool/UpdateDocs/Program.cs | 2 +- tool/UpdateDocs/UpdateDocs.csproj | 62 ++------------ tool/UpdateDocs/UpdateDocs.sln | 6 -- tool/UpdateDocsCore/Program.cs | 98 ----------------------- tool/UpdateDocsCore/UpdateDocsCore.csproj | 12 --- 5 files changed, 9 insertions(+), 171 deletions(-) delete mode 100644 tool/UpdateDocsCore/Program.cs delete mode 100644 tool/UpdateDocsCore/UpdateDocsCore.csproj diff --git a/tool/UpdateDocs/Program.cs b/tool/UpdateDocs/Program.cs index da99806..174fdd7 100644 --- a/tool/UpdateDocs/Program.cs +++ b/tool/UpdateDocs/Program.cs @@ -74,7 +74,7 @@ namespace UpdateDocs output = oas20 + "/" + fileName + ".json"; File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0)); - Console.WriteLine("Output [ " + fileName + " ] Succeessful!"); + Console.WriteLine("Output [ " + fileName + " ] Successful!"); } Console.WriteLine("\n==> All Done!"); diff --git a/tool/UpdateDocs/UpdateDocs.csproj b/tool/UpdateDocs/UpdateDocs.csproj index 809b34e..0ad79a9 100644 --- a/tool/UpdateDocs/UpdateDocs.csproj +++ b/tool/UpdateDocs/UpdateDocs.csproj @@ -1,64 +1,18 @@ - - - + - Debug - AnyCPU - {6D5453C2-E35F-4CC6-B774-4C676F5F33D1} + net5.0 Exe - UpdateDocs - UpdateDocs - v4.6.1 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\net461\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + false - - packages\Microsoft.OData.Edm.7.6.1\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll - - - packages\Microsoft.OpenApi.1.2.2\lib\net46\Microsoft.OpenApi.dll - - - - - - - - - + - - + + - - {ff3acd93-19e0-486c-9c0f-fa1c2e7fc8c2} - Microsoft.OpenApi.OData.Reader - + + - - - - \ No newline at end of file diff --git a/tool/UpdateDocs/UpdateDocs.sln b/tool/UpdateDocs/UpdateDocs.sln index 9503da8..cd707c7 100644 --- a/tool/UpdateDocs/UpdateDocs.sln +++ b/tool/UpdateDocs/UpdateDocs.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateDocs", "UpdateDocs.cs EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.OData.Reader", "..\..\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj", "{B7A15A06-0B61-4557-9BD4-0E4F32DE119D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateDocsCore", "..\UpdateDocsCore\UpdateDocsCore.csproj", "{810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -23,10 +21,6 @@ Global {B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Release|Any CPU.ActiveCfg = Release|Any CPU {B7A15A06-0B61-4557-9BD4-0E4F32DE119D}.Release|Any CPU.Build.0 = Release|Any CPU - {810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {810B988E-24A2-4B6F-8FD3-B5B9FB25A44B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tool/UpdateDocsCore/Program.cs b/tool/UpdateDocsCore/Program.cs deleted file mode 100644 index da99806..0000000 --- a/tool/UpdateDocsCore/Program.cs +++ /dev/null @@ -1,98 +0,0 @@ -//--------------------------------------------------------------------- -// -// Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. -// -//--------------------------------------------------------------------- - -using System; -using System.IO; -using System.Xml.Linq; -using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Csdl; -using Microsoft.OpenApi; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.OData; -using Microsoft.OpenApi.Extensions; - -namespace UpdateDocs -{ - class Program - { - static int Main(string[] args) - { - // we assume the path are existed for simplicity. - string path = Directory.GetCurrentDirectory(); - string csdl = path + "/../../../../../docs/csdl"; - string oas20 = path + "/../../../../../docs/oas_2_0"; - string oas30 = path + "/../../../../../docs/oas3_0_0"; - - foreach (var filePath in Directory.GetFiles(csdl, "*.xml")) - { - Console.WriteLine(filePath); - - IEdmModel model = LoadEdmModel(filePath); - if (model == null) - { - continue; - } - - FileInfo fileInfo = new FileInfo(filePath); - string fileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - 4); - - OpenApiConvertSettings settings = new OpenApiConvertSettings(); - if (fileName.Contains("graph.beta")) - { - settings.PrefixEntityTypeNameBeforeKey = true; - settings.ServiceRoot = new Uri("https://graph.microsoft.com/beta"); - } - else if (fileName.Contains("graph1.0")) - { - settings.PrefixEntityTypeNameBeforeKey = true; - settings.ServiceRoot = new Uri("https://graph.microsoft.com/v1.0"); - } - - OpenApiDocument document = model.ConvertToOpenApi(settings); - - string output;/* = oas20 + "/" + fileName + ".yaml"; - File.WriteAllText(output, document.SerializeAsYaml(OpenApiSpecVersion.OpenApi2_0)); - - output = oas20 + "/" + fileName + ".json"; - File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0)); - - output = oas30 + "/" + fileName + ".yaml"; - File.WriteAllText(output, document.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0)); - - output = oas30 + "/" + fileName + ".json"; - File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0)); - */ - settings.EnableKeyAsSegment = true; - settings.EnableUnqualifiedCall = true; - output = oas30 + "/" + fileName + ".json"; - document = model.ConvertToOpenApi(settings); - File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0)); - - output = oas20 + "/" + fileName + ".json"; - File.WriteAllText(output, document.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0)); - - Console.WriteLine("Output [ " + fileName + " ] Succeessful!"); - } - - Console.WriteLine("\n==> All Done!"); - return 0; - } - - public static IEdmModel LoadEdmModel(string file) - { - try - { - string csdl = File.ReadAllText(file); - return CsdlReader.Parse(XElement.Parse(csdl).CreateReader()); - } - catch - { - Console.WriteLine("Cannot load EDM from file: " + file); - return null; - } - } - } -} diff --git a/tool/UpdateDocsCore/UpdateDocsCore.csproj b/tool/UpdateDocsCore/UpdateDocsCore.csproj deleted file mode 100644 index 0599afa..0000000 --- a/tool/UpdateDocsCore/UpdateDocsCore.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - net5.0 - - - - - - -