Skip to content

Commit 7836a2c

Browse files
committed
Merge branch 'dev' into mk/implement-AOT
2 parents 268a398 + d88c36f commit 7836a2c

File tree

206 files changed

+1019
-1275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+1019
-1275
lines changed

src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using Microsoft.OpenApi.Interfaces;
1010
using Microsoft.OpenApi.Reader;
1111
using SharpYaml.Serialization;
12-
using System.Linq;
1312
using Microsoft.OpenApi.Models;
1413
using System;
1514
using System.Text;
@@ -86,6 +85,7 @@ public static ReadResult Read(JsonNode jsonNode, OpenApiReaderSettings settings,
8685
/// <inheritdoc/>
8786
public T ReadFragment<T>(MemoryStream input,
8887
OpenApiSpecVersion version,
88+
OpenApiDocument openApiDocument,
8989
out OpenApiDiagnostic diagnostic,
9090
OpenApiReaderSettings settings = null) where T : IOpenApiElement
9191
{
@@ -105,13 +105,13 @@ public T ReadFragment<T>(MemoryStream input,
105105
return default;
106106
}
107107

108-
return ReadFragment<T>(jsonNode, version, out diagnostic, settings);
108+
return ReadFragment<T>(jsonNode, version, openApiDocument, out diagnostic, settings);
109109
}
110110

111111
/// <inheritdoc/>
112-
public static T ReadFragment<T>(JsonNode input, OpenApiSpecVersion version, out OpenApiDiagnostic diagnostic, OpenApiReaderSettings settings = null) where T : IOpenApiElement
112+
public static T ReadFragment<T>(JsonNode input, OpenApiSpecVersion version, OpenApiDocument openApiDocument, out OpenApiDiagnostic diagnostic, OpenApiReaderSettings settings = null) where T : IOpenApiElement
113113
{
114-
return _jsonReader.ReadFragment<T>(input, version, out diagnostic, settings);
114+
return _jsonReader.ReadFragment<T>(input, version, openApiDocument, out diagnostic, settings);
115115
}
116116

117117
/// <summary>

src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="9.0.0" />
16+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="9.0.1" />
1717
<!-- Microsoft.Windows.Compatibility 8.0.8 depends on 8.0.0 this dependency can be removed once they update theirs -->
1818
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
1919
</ItemGroup>

src/Microsoft.OpenApi/Interfaces/IOpenApiReader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Licensed under the MIT license.
33

44
using System.IO;
5-
using System.Text.Json.Nodes;
65
using System.Threading;
76
using System.Threading.Tasks;
7+
using Microsoft.OpenApi.Models;
88
using Microsoft.OpenApi.Reader;
99

1010
namespace Microsoft.OpenApi.Interfaces
@@ -36,9 +36,10 @@ public interface IOpenApiReader
3636
/// </summary>
3737
/// <param name="input">Memory stream containing OpenAPI description to parse.</param>
3838
/// <param name="version">Version of the OpenAPI specification that the fragment conforms to.</param>
39+
/// <param name="openApiDocument">The OpenApiDocument object to which the fragment belongs, used to lookup references.</param>
3940
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing.</param>
4041
/// <param name="settings">The OpenApiReader settings.</param>
4142
/// <returns>Instance of newly created IOpenApiElement.</returns>
42-
T ReadFragment<T>(MemoryStream input, OpenApiSpecVersion version, out OpenApiDiagnostic diagnostic, OpenApiReaderSettings settings = null) where T : IOpenApiElement;
43+
T ReadFragment<T>(MemoryStream input, OpenApiSpecVersion version, OpenApiDocument openApiDocument, out OpenApiDiagnostic diagnostic, OpenApiReaderSettings settings = null) where T : IOpenApiElement;
4344
}
4445
}

src/Microsoft.OpenApi/Interfaces/IOpenApiVersionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal interface IOpenApiVersionService
2828
/// <param name="node">document fragment node</param>
2929
/// <param name="doc">A host document instance.</param>
3030
/// <returns>Instance of OpenAPIElement</returns>
31-
T LoadElement<T>(ParseNode node, OpenApiDocument doc = null) where T : IOpenApiElement;
31+
T LoadElement<T>(ParseNode node, OpenApiDocument doc) where T : IOpenApiElement;
3232

3333
/// <summary>
3434
/// Converts a generic RootNode instance into a strongly typed OpenApiDocument

src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumFlagsExtension.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
using System;
77
using Microsoft.OpenApi.Extensions;
8-
using Microsoft.OpenApi.Any;
98
using Microsoft.OpenApi.Interfaces;
109
using Microsoft.OpenApi.Writers;
1110
using System.Text.Json.Nodes;

src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiEnumValuesDescriptionExtension.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Collections.Generic;
88
using System.Linq;
99
using Microsoft.OpenApi.Extensions;
10-
using Microsoft.OpenApi.Any;
1110
using Microsoft.OpenApi.Interfaces;
1211
using Microsoft.OpenApi.Writers;
1312
using System.Text.Json.Nodes;

src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPagingExtension.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
using System;
77
using Microsoft.OpenApi.Extensions;
8-
using Microsoft.OpenApi.Any;
98
using Microsoft.OpenApi.Interfaces;
109
using Microsoft.OpenApi.Writers;
1110
using System.Text.Json.Nodes;

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -501,21 +501,6 @@ private static string ConvertByteArrayToString(byte[] hash)
501501
throw new ArgumentException(Properties.SRResource.LocalReferenceRequiresType);
502502
}
503503

504-
// Special case for Tag
505-
if (reference.Type == ReferenceType.Tag)
506-
{
507-
foreach (var tag in this.Tags ?? Enumerable.Empty<OpenApiTag>())
508-
{
509-
if (tag.Name == reference.Id)
510-
{
511-
tag.Reference = reference;
512-
return tag;
513-
}
514-
}
515-
516-
return null;
517-
}
518-
519504
string uriLocation;
520505
if (reference.Id.Contains("/")) // this means its a URL reference
521506
{

src/Microsoft.OpenApi/Models/OpenApiExample.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
using System;
54
using System.Collections.Generic;
65
using System.Text.Json.Nodes;
7-
using Microsoft.OpenApi.Any;
86
using Microsoft.OpenApi.Helpers;
97
using Microsoft.OpenApi.Interfaces;
108
using Microsoft.OpenApi.Writers;

src/Microsoft.OpenApi/Models/OpenApiOperation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class OpenApiOperation : IOpenApiSerializable, IOpenApiExtensible, IOpenA
2626
/// A list of tags for API documentation control.
2727
/// Tags can be used for logical grouping of operations by resources or any other qualifier.
2828
/// </summary>
29-
public IList<OpenApiTag>? Tags { get; set; } = new List<OpenApiTag>();
29+
public IList<OpenApiTagReference>? Tags { get; set; } = [];
3030

3131
/// <summary>
3232
/// A short summary of what the operation does.
@@ -121,7 +121,7 @@ public OpenApiOperation() { }
121121
/// </summary>
122122
public OpenApiOperation(OpenApiOperation? operation)
123123
{
124-
Tags = operation?.Tags != null ? new List<OpenApiTag>(operation.Tags) : null;
124+
Tags = operation?.Tags != null ? new List<OpenApiTagReference>(operation.Tags) : null;
125125
Summary = operation?.Summary ?? Summary;
126126
Description = operation?.Description ?? Description;
127127
ExternalDocs = operation?.ExternalDocs != null ? new(operation?.ExternalDocs) : null;

0 commit comments

Comments
 (0)