Skip to content

Commit 5eb1481

Browse files
authored
Merge pull request #828 from microsoft/release/1.3.0
Release/1.3.0
2 parents 13e2d06 + 274acb5 commit 5eb1481

22 files changed

+179
-76
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,13 @@ stages:
270270
inputs:
271271
source: current
272272
- pwsh: |
273-
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.Hidi-* -recurse | select -First 1
274-
$artifactVersion= $artifactName -replace "Microsoft.OpenApi.Hidi-", ""
273+
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
274+
$artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", ""
275275
#Set Variable $artifactName and $artifactVersion
276276
Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion"
277277
Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true]$artifactName.FullName"
278+
echo "$artifactName"
279+
echo "$artifactVersion"
278280
displayName: 'Fetch Artifact Name'
279281
280282
- task: NuGetCommand@2
@@ -290,7 +292,7 @@ stages:
290292
gitHubConnection: 'Github-MaggieKimani1'
291293
tagSource: userSpecifiedTag
292294
tag: '$(artifactVersion)'
293-
title: '$(artifactName)'
295+
title: '$(artifactVersion)'
294296
releaseNotesSource: inline
295297
assets: '$(Pipeline.Workspace)\**\*.exe'
296298
changeLogType: issueBased

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PackageId>Microsoft.OpenApi.Hidi</PackageId>
1616
<ToolCommandName>hidi</ToolCommandName>
1717
<PackageOutputPath>./../../artifacts</PackageOutputPath>
18-
<Version>0.5.0-preview6</Version>
18+
<Version>1.0.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>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Company>Microsoft</Company>
1111
<Title>Microsoft.OpenApi.Readers</Title>
1212
<PackageId>Microsoft.OpenApi.Readers</PackageId>
13-
<Version>1.3.1-preview6</Version>
13+
<Version>1.3.1</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>

src/Microsoft.OpenApi.Readers/OpenApiDiagnostic.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public class OpenApiDiagnostic : IDiagnostic
1717
/// </summary>
1818
public IList<OpenApiError> Errors { get; set; } = new List<OpenApiError>();
1919

20+
/// <summary>
21+
/// List of all warnings
22+
/// </summary>
23+
public IList<OpenApiError> Warnings { get; set; } = new List<OpenApiError>();
24+
2025
/// <summary>
2126
/// Open API specification version of the document parsed.
2227
/// </summary>

src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Linq;
78
using System.Threading.Tasks;
89
using Microsoft.OpenApi.Exceptions;
910
using Microsoft.OpenApi.Extensions;
@@ -12,6 +13,7 @@
1213
using Microsoft.OpenApi.Readers.Interface;
1314
using Microsoft.OpenApi.Readers.Services;
1415
using Microsoft.OpenApi.Services;
16+
using Microsoft.OpenApi.Validations;
1517
using SharpYaml.Serialization;
1618

1719
namespace Microsoft.OpenApi.Readers
@@ -68,11 +70,16 @@ public OpenApiDocument Read(YamlDocument input, out OpenApiDiagnostic diagnostic
6870
// Validate the document
6971
if (_settings.RuleSet != null && _settings.RuleSet.Rules.Count > 0)
7072
{
71-
var errors = document.Validate(_settings.RuleSet);
72-
foreach (var item in errors)
73+
var openApiErrors = document.Validate(_settings.RuleSet);
74+
foreach (var item in openApiErrors.Where(e => e is OpenApiValidatorError))
7375
{
7476
diagnostic.Errors.Add(item);
7577
}
78+
foreach (var item in openApiErrors.Where(e => e is OpenApiValidatorWarning))
79+
{
80+
diagnostic.Warnings.Add(item);
81+
}
82+
7683
}
7784

7885
return document;

src/Microsoft.OpenApi/Extensions/OpenApiElementExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license.
33

44
using System.Collections.Generic;
5+
using System.Linq;
56
using Microsoft.OpenApi.Interfaces;
67
using Microsoft.OpenApi.Models;
78
using Microsoft.OpenApi.Services;
@@ -25,7 +26,7 @@ public static IEnumerable<OpenApiError> Validate(this IOpenApiElement element, V
2526
var validator = new OpenApiValidator(ruleSet);
2627
var walker = new OpenApiWalker(validator);
2728
walker.Walk(element);
28-
return validator.Errors;
29+
return validator.Errors.Cast<OpenApiError>().Union(validator.Warnings);
2930
}
3031
}
3132
}

src/Microsoft.OpenApi/Microsoft.OpenApi.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Company>Microsoft</Company>
1212
<Title>Microsoft.OpenApi</Title>
1313
<PackageId>Microsoft.OpenApi</PackageId>
14-
<Version>1.3.1-preview6</Version>
14+
<Version>1.3.1</Version>
1515
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
1616
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
1717
<PackageTags>OpenAPI .NET</PackageTags>
@@ -38,7 +38,6 @@
3838

3939
<ItemGroup>
4040
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
41-
<PackageReference Include="System.Text.Json" Version="6.0.2" />
4241
</ItemGroup>
4342

4443
<ItemGroup>

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,14 @@ internal T ResolveReferenceTo<T>(OpenApiReference reference) where T : class, IO
348348
}
349349
}
350350

351+
/// <summary>
352+
/// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
353+
/// </summary>
354+
public IOpenApiReferenceable ResolveReference(OpenApiReference reference)
355+
{
356+
return ResolveReference(reference, false);
357+
}
358+
351359
/// <summary>
352360
/// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
353361
/// </summary>

src/Microsoft.OpenApi/Validations/IValidationContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public interface IValidationContext
1414
/// <param name="error">Error to register.</param>
1515
void AddError(OpenApiValidatorError error);
1616

17+
/// <summary>
18+
/// Register a warning with the validation context.
19+
/// </summary>
20+
/// <param name="warning">Warning to register.</param>
21+
void AddWarning(OpenApiValidatorWarning warning);
22+
1723
/// <summary>
1824
/// Allow Rule to indicate validation error occured at a deeper context level.
1925
/// </summary>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Microsoft.OpenApi.Exceptions;
5+
using Microsoft.OpenApi.Models;
6+
7+
namespace Microsoft.OpenApi.Validations
8+
{
9+
/// <summary>
10+
/// Warnings detected when validating an OpenAPI Element
11+
/// </summary>
12+
public class OpenApiValidatorWarning : OpenApiError
13+
{
14+
/// <summary>
15+
/// Initializes the <see cref="OpenApiError"/> class.
16+
/// </summary>
17+
public OpenApiValidatorWarning(string ruleName, string pointer, string message) : base(pointer, message)
18+
{
19+
RuleName = ruleName;
20+
}
21+
22+
/// <summary>
23+
/// Name of rule that detected the error.
24+
/// </summary>
25+
public string RuleName { get; set; }
26+
}
27+
28+
}

0 commit comments

Comments
 (0)