Skip to content

Commit 7e91401

Browse files
committed
Merge remote-tracking branch 'origin/vnext' into pr/DCollart/524
2 parents cfe7295 + d4a0b8e commit 7e91401

36 files changed

+1216
-125
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
5+
6+
trigger:
7+
branches:
8+
include:
9+
- master
10+
pr: none
11+
12+
pool:
13+
name: Azure Pipelines
14+
vmImage: windows-latest
15+
demands:
16+
- msbuild
17+
- vstest
18+
19+
steps:
20+
- task: NuGetCommand@2
21+
displayName: 'NuGet restore'
22+
23+
- task: MSBuild@1
24+
displayName: 'Build solution **/*.sln'
25+
inputs:
26+
configuration: Release
27+
28+
- task: VSTest@2
29+
displayName: 'XUnit Tests'
30+
inputs:
31+
testAssemblyVer2: |
32+
**\*.Tests.dll
33+
34+
vsTestVersion: 16.0
35+
codeCoverageEnabled: true
36+
37+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
38+
displayName: 'ESRP CodeSigning'
39+
inputs:
40+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
41+
FolderPath: src
42+
signConfigType: inlineSignParams
43+
inlineOperation: |
44+
[
45+
{
46+
"keyCode": "CP-230012",
47+
"operationSetCode": "SigntoolSign",
48+
"parameters": [
49+
{
50+
"parameterName": "OpusName",
51+
"parameterValue": "Microsoft"
52+
},
53+
{
54+
"parameterName": "OpusInfo",
55+
"parameterValue": "http://www.microsoft.com"
56+
},
57+
{
58+
"parameterName": "FileDigest",
59+
"parameterValue": "/fd \"SHA256\""
60+
},
61+
{
62+
"parameterName": "PageHash",
63+
"parameterValue": "/NPH"
64+
},
65+
{
66+
"parameterName": "TimeStamp",
67+
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
68+
}
69+
],
70+
"toolName": "sign",
71+
"toolVersion": "1.0"
72+
},
73+
{
74+
"keyCode": "CP-230012",
75+
"operationSetCode": "SigntoolVerify",
76+
"parameters": [ ],
77+
"toolName": "sign",
78+
"toolVersion": "1.0"
79+
}
80+
]
81+
SessionTimeout: 20
82+
83+
- task: MSBuild@1
84+
displayName: 'Pack OpenAPI'
85+
inputs:
86+
solution: src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
87+
configuration: Release
88+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
89+
90+
- task: MSBuild@1
91+
displayName: 'Pack OpenAPI Readers'
92+
inputs:
93+
solution: src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
94+
configuration: Release
95+
msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg'
96+
97+
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
98+
displayName: 'ESRP CodeSigning Nuget Packages'
99+
inputs:
100+
ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)'
101+
FolderPath: '$(Build.ArtifactStagingDirectory)'
102+
Pattern: '*.nupkg'
103+
signConfigType: inlineSignParams
104+
inlineOperation: |
105+
[
106+
{
107+
"keyCode": "CP-401405",
108+
"operationSetCode": "NuGetSign",
109+
"parameters": [ ],
110+
"toolName": "sign",
111+
"toolVersion": "1.0"
112+
},
113+
{
114+
"keyCode": "CP-401405",
115+
"operationSetCode": "NuGetVerify",
116+
"parameters": [ ],
117+
"toolName": "sign",
118+
"toolVersion": "1.0"
119+
}
120+
]
121+
SessionTimeout: 20
122+
123+
- task: PublishBuildArtifacts@1
124+
displayName: 'Publish Artifact: Nugets'
125+
inputs:
126+
ArtifactName: Nugets

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
# default location of `.github/workflows`
5+
directory: "/"
6+
open-pull-requests-limit: 10
7+
schedule:
8+
interval: "weekly"
9+
10+
- package-ecosystem: "nuget"
11+
# location of package manifests
12+
directory: "/"
13+
open-pull-requests-limit: 10
14+
schedule:
15+
interval: "daily"
16+
17+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/codeql-analysis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 8 * * *'
8+
9+
jobs:
10+
analyze:
11+
name: CodeQL Analysis
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
id: checkout_repo
16+
uses: actions/checkout@v2
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v1
20+
with:
21+
dotnet-version: 5.0.x
22+
23+
- name: Initialize CodeQL
24+
id: init_codeql
25+
uses: github/codeql-action/init@v1
26+
with:
27+
queries: security-and-quality
28+
29+
- name: Build projects
30+
id: build_projects
31+
shell: pwsh
32+
run: |
33+
$projectsArray = @(
34+
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj',
35+
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj',
36+
'.\src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj'
37+
)
38+
39+
$projectsArray | ForEach-Object {
40+
dotnet build $PSItem -c Release
41+
}
42+
43+
- name: Perform CodeQL Analysis
44+
id: analyze_codeql
45+
uses: github/codeql-action/analyze@v1
46+
47+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

build.cmd

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ dotnet msbuild %PROJ% /t:restore /p:Configuration=Release
1313
dotnet msbuild %PROJ% /t:build /p:Configuration=Release
1414
dotnet msbuild %PROJ% /t:pack /p:Configuration=Release;PackageOutputPath=%~dp0artifacts
1515

16-
goto :end
17-
:error
18-
echo Version parameter missing e.g. build.cmd 1.0.0-beta0008
16+
Echo Building Microsoft.OpenApi.Tool
17+
18+
SET PROJ=%~dp0src\Microsoft.OpenApi.Tool\Microsoft.OpenApi.Tool.csproj
19+
dotnet msbuild %PROJ% /t:restore /p:Configuration=Release
20+
dotnet msbuild %PROJ% /t:build /p:Configuration=Release
21+
dotnet msbuild %PROJ% /t:pack /p:Configuration=Release;PackageOutputPath=%~dp0artifacts
1922

2023
:end

src/Microsoft.OpenApi.Readers/Exceptions/OpenApiReaderException.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ public OpenApiReaderException() { }
2424
/// <param name="message">Plain text error message for this exception.</param>
2525
public OpenApiReaderException(string message) : base(message) { }
2626

27+
/// <summary>
28+
/// Initializes the <see cref="OpenApiReaderException"/> class with a custom message.
29+
/// </summary>
30+
/// <param name="message">Plain text error message for this exception.</param>
31+
/// <param name="context">Context of current parsing process.</param>
32+
public OpenApiReaderException(string message, ParsingContext context) : base(message) {
33+
Pointer = context.GetLocation();
34+
}
35+
2736
/// <summary>
2837
/// Initializes the <see cref="OpenApiReaderException"/> class with a message and line, column location of error.
2938
/// </summary>
@@ -42,5 +51,6 @@ public OpenApiReaderException(string message, YamlNode node) : base(message)
4251
/// <param name="message">Plain text error message for this exception.</param>
4352
/// <param name="innerException">Inner exception that caused this exception to be thrown.</param>
4453
public OpenApiReaderException(string message, Exception innerException) : base(message, innerException) { }
54+
4555
}
4656
}

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,35 @@
1010
<Company>Microsoft</Company>
1111
<Title>Microsoft.OpenApi.Readers</Title>
1212
<PackageId>Microsoft.OpenApi.Readers</PackageId>
13-
<Version>1.2.3</Version>
13+
<Version>1.3.0-preview</Version>
1414
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
1515
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
1616
<PackageTags>OpenAPI .NET</PackageTags>
17-
17+
<RepositoryUrl>https://github.com/Microsoft/OpenAPI.NET</RepositoryUrl>
18+
<PackageReleaseNotes>
19+
- Publish symbols.
20+
</PackageReleaseNotes>
1821
<AssemblyName>Microsoft.OpenApi.Readers</AssemblyName>
1922
<RootNamespace>Microsoft.OpenApi.Readers</RootNamespace>
2023
<SignAssembly>true</SignAssembly>
24+
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
25+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2126
</PropertyGroup>
2227

2328
<PropertyGroup>
2429
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.OpenApi.xml</DocumentationFile>
2530
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
2631
</PropertyGroup>
2732

33+
<!-- https://github.com/clairernovotny/DeterministicBuilds#deterministic-builds -->
34+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
35+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
36+
</PropertyGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
40+
</ItemGroup>
41+
2842
<ItemGroup>
2943
<PackageReference Include="SharpYaml" Version="1.6.6" />
3044
</ItemGroup>

src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using Microsoft.OpenApi.Any;
9-
using Microsoft.OpenApi.Exceptions;
10-
using Microsoft.OpenApi.Interfaces;
11-
using Microsoft.OpenApi.Models;
9+
using Microsoft.OpenApi.Readers.Exceptions;
1210
using SharpYaml.Serialization;
1311

1412
namespace Microsoft.OpenApi.Readers.ParseNodes
@@ -27,8 +25,8 @@ public override List<T> CreateList<T>(Func<MapNode, T> map)
2725
{
2826
if (_nodeList == null)
2927
{
30-
throw new OpenApiException(
31-
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
28+
throw new OpenApiReaderException(
29+
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}", _nodeList);
3230
}
3331

3432
return _nodeList.Select(n => map(new MapNode(Context, n as YamlMappingNode)))
@@ -47,8 +45,8 @@ public override List<T> CreateSimpleList<T>(Func<ValueNode, T> map)
4745
{
4846
if (_nodeList == null)
4947
{
50-
throw new OpenApiException(
51-
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
48+
throw new OpenApiReaderException(
49+
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}", _nodeList);
5250
}
5351

5452
return _nodeList.Select(n => map(new ValueNode(Context, n))).ToList();

0 commit comments

Comments
 (0)