Skip to content

Commit fa45d12

Browse files
authored
Merge branch 'vnext' into mk/fix-parsing-errors
2 parents 39ce0e9 + f9b8375 commit fa45d12

24 files changed

+148
-186
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ pool:
1717
- vstest
1818

1919
steps:
20+
- task: UseDotNet@2
21+
displayName: 'Use .NET Core sdk'
22+
inputs:
23+
packageType: 'sdk'
24+
version: '6.0.x'
25+
includePreviewVersions: true
26+
2027
- task: NuGetCommand@2
2128
displayName: 'NuGet restore'
2229

@@ -85,21 +92,21 @@ steps:
8592
inputs:
8693
solution: src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
8794
configuration: Release
88-
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
95+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/Nugets /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
8996

9097
- task: MSBuild@1
9198
displayName: 'Pack OpenAPI Readers'
9299
inputs:
93100
solution: src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
94101
configuration: Release
95-
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
102+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/Nugets /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
96103

97104
- task: MSBuild@1
98105
displayName: 'Pack OpenApi Hidi'
99106
inputs:
100107
solution: src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
101108
configuration: Release
102-
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
109+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)/Nugets /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
103110

104111
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
105112
displayName: 'ESRP CodeSigning Nuget Packages'
@@ -127,7 +134,33 @@ steps:
127134
]
128135
SessionTimeout: 20
129136

137+
- task: PowerShell@2
138+
displayName: "Get Hidi's version-number from .csproj"
139+
inputs:
140+
targetType: 'inline'
141+
script: |
142+
$xml = [Xml] (Get-Content .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)
143+
$version = $xml.Project.PropertyGroup.Version
144+
echo $version
145+
echo "##vso[task.setvariable variable=version]$version"
146+
147+
# publish hidi as an .exe
148+
- task: DotNetCoreCLI@2
149+
inputs:
150+
command: 'publish'
151+
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(version) --no-dependencies
152+
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
153+
publishWebProjects: False
154+
zipAfterPublish: false
155+
130156
- task: PublishBuildArtifacts@1
131157
displayName: 'Publish Artifact: Nugets'
132158
inputs:
133-
ArtifactName: Nugets
159+
ArtifactName: Nugets
160+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Nugets'
161+
162+
- task: PublishBuildArtifacts@1
163+
displayName: 'Publish Artifact: Hidi'
164+
inputs:
165+
ArtifactName: Microsoft.OpenApi.Hidi-v$(version)
166+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi-v$(version)'

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v1
1818
with:
19-
dotnet-version: 5.0.x
19+
dotnet-version: 6.0.x
2020

2121
- name: Data gatherer
2222
id: data_gatherer

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup .NET
2020
uses: actions/setup-dotnet@v1
2121
with:
22-
dotnet-version: 5.0.x
22+
dotnet-version: 6.0.x
2323

2424
- name: Initialize CodeQL
2525
id: init_codeql

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/netcoreapp3.1/Microsoft.OpenApi.Hidi.dll",
13+
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net6.0/Microsoft.OpenApi.Hidi.dll",
1414
"args": [],
1515
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi",
1616
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

.vscode/tasks.json

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,43 @@
55
"tasks": [
66
{
77
"label": "build",
8-
"type": "shell",
9-
"command": "msbuild",
8+
"command": "dotnet",
9+
"type": "process",
10+
"group": "build",
11+
"args": [
12+
"build",
13+
"${workspaceFolder}/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj",
14+
"/property:GenerateFullPaths=true",
15+
"/consoleloggerparameters:NoSummary"
16+
],
17+
"problemMatcher": "$msCompile"
18+
},
19+
{
20+
"label": "test",
21+
"command": "dotnet",
22+
"type": "process",
23+
"group": "test",
1024
"args": [
25+
"test",
26+
"${workspaceFolder}/Microsoft.OpenApi.sln",
1127
"/property:GenerateFullPaths=true",
12-
"/t:build"
28+
"/consoleloggerparameters:NoSummary",
29+
"--collect:\"XPlat Code Coverage\""
1330
],
31+
"problemMatcher": "$msCompile"
32+
},
33+
{
34+
"label": "watch",
35+
"command": "dotnet",
36+
"type": "process",
1437
"group": "build",
15-
"presentation": {
16-
"reveal": "silent"
17-
},
38+
"args": [
39+
"watch",
40+
"run",
41+
"${workspaceFolder}/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj",
42+
"/property:GenerateFullPaths=true",
43+
"/consoleloggerparameters:NoSummary"
44+
],
1845
"problemMatcher": "$msCompile"
1946
},
2047
{

Microsoft.OpenApi.sln

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29613.14
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32210.238
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi", "src\Microsoft.OpenApi\Microsoft.OpenApi.csproj", "{A8E50143-69B2-472A-9D45-3F9A05D13202}"
77
EndProject
@@ -12,7 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
readme.md = readme.md
1313
EndProjectSection
1414
EndProject
15-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Workbench", "src\Microsoft.OpenApi.Workbench\Microsoft.OpenApi.Workbench.csproj", "{6A5E91E5-0441-46EE-AEB9-8334981B7F08}"
15+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Workbench", "src\Microsoft.OpenApi.Workbench\Microsoft.OpenApi.Workbench.csproj", "{6A5E91E5-0441-46EE-AEB9-8334981B7F08}"
1616
EndProject
1717
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Readers", "src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj", "{79933258-0126-4382-8755-D50820ECC483}"
1818
EndProject

src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<LangVersion>9.0</LangVersion>
77
<PackAsTool>true</PackAsTool>
88
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
@@ -15,13 +15,14 @@
1515
<PackageId>Microsoft.OpenApi.Hidi</PackageId>
1616
<ToolCommandName>hidi</ToolCommandName>
1717
<PackageOutputPath>./../../artifacts</PackageOutputPath>
18-
<Version>0.5.0-preview4</Version>
18+
<Version>0.6.0-preview1</Version>
1919
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
2020
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
2121
<PackageTags>OpenAPI .NET</PackageTags>
2222
<RepositoryUrl>https://github.com/Microsoft/OpenAPI.NET</RepositoryUrl>
2323
<PackageReleaseNotes>
24-
- Publish symbols.
24+
- Upgrades Microsoft.OpenApi.OData to 1.0.10-preview1
25+
- Fixes an issue where hidi would not process async operations
2526
</PackageReleaseNotes>
2627
<AssemblyName>Microsoft.OpenApi.Hidi</AssemblyName>
2728
<RootNamespace>Microsoft.OpenApi.Hidi</RootNamespace>
@@ -37,7 +38,7 @@
3738
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
3839
<PackageReference Include="System.CommandLine" Version="2.0.0-beta2.21617.1" />
3940
<PackageReference Include="Microsoft.OData.Edm" Version="7.10.0" />
40-
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.0.9" />
41+
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.0.10-preview1" />
4142
</ItemGroup>
4243

4344
<ItemGroup>

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.OpenApi.Hidi
2727
{
2828
public class OpenApiService
2929
{
30-
public static async void ProcessOpenApiDocument(
30+
public static async Task ProcessOpenApiDocument(
3131
string openapi,
3232
string csdl,
3333
FileInfo output,
@@ -92,7 +92,7 @@ string filterbycollection
9292
version ??= OpenApiSpecVersion.OpenApi3_0;
9393

9494
stream = await GetStream(csdl, logger);
95-
document = ConvertCsdlToOpenApi(stream);
95+
document = await ConvertCsdlToOpenApi(stream);
9696
}
9797
else
9898
{
@@ -198,16 +198,20 @@ string filterbycollection
198198
/// </summary>
199199
/// <param name="csdl">The CSDL stream.</param>
200200
/// <returns>An OpenAPI document.</returns>
201-
public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl)
201+
public static async Task<OpenApiDocument> ConvertCsdlToOpenApi(Stream csdl)
202202
{
203203
using var reader = new StreamReader(csdl);
204-
var csdlText = reader.ReadToEndAsync().GetAwaiter().GetResult();
204+
var csdlText = await reader.ReadToEndAsync();
205205
var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader());
206206

207207
var settings = new OpenApiConvertSettings()
208208
{
209+
AddSingleQuotesForStringParameters = true,
210+
AddEnumDescriptionExtension = true,
211+
DeclarePathParametersOnPathItem = true,
209212
EnableKeyAsSegment = true,
210213
EnableOperationId = true,
214+
ErrorResponsesAsDefault = false,
211215
PrefixEntityTypeNameBeforeKey = true,
212216
TagDepth = 2,
213217
EnablePagination = true,

src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0</TargetFrameworks>
44
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -36,7 +36,7 @@
3636
</PropertyGroup>
3737

3838
<ItemGroup>
39-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
39+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
4040
</ItemGroup>
4141

4242
<ItemGroup>

src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal static partial class OpenApiV2Deserializer
3030
{
3131
case "basic":
3232
o.Type = SecuritySchemeType.Http;
33-
o.Scheme = "basic";
33+
o.Scheme = OpenApiConstants.Basic;
3434
break;
3535

3636
case "apiKey":

0 commit comments

Comments
 (0)