Skip to content

Commit 3154d45

Browse files
Merge branch 'vnext' into mk/fix-json-reader
2 parents 87ce841 + 6899424 commit 3154d45

File tree

51 files changed

+309
-321
lines changed

Some content is hidden

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

51 files changed

+309
-321
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ extends:
210210
dependsOn: build
211211
jobs:
212212
- deployment: deploy_hidi
213+
templateContext:
214+
type: releaseJob
215+
isProduction: true
216+
inputs:
217+
- input: pipelineArtifact
218+
artifactName: Nugets
219+
targetPath: '$(Pipeline.Workspace)'
213220
dependsOn: []
214221
environment: nuget-org
215222
strategy:
@@ -218,11 +225,6 @@ extends:
218225
pool:
219226
vmImage: ubuntu-latest
220227
steps:
221-
- task: DownloadPipelineArtifact@2
222-
displayName: Download nupkg from artifacts
223-
inputs:
224-
artifact: Nugets
225-
source: current
226228
- task: DownloadPipelineArtifact@2
227229
displayName: Download hidi executable from artifacts
228230
inputs:
@@ -264,6 +266,13 @@ extends:
264266
]'
265267

266268
- deployment: deploy_lib
269+
templateContext:
270+
type: releaseJob
271+
isProduction: true
272+
inputs:
273+
- input: pipelineArtifact
274+
artifactName: Nugets
275+
targetPath: '$(Pipeline.Workspace)'
267276
dependsOn: []
268277
environment: nuget-org
269278
strategy:
@@ -272,11 +281,6 @@ extends:
272281
pool:
273282
vmImage: ubuntu-latest
274283
steps:
275-
- task: DownloadPipelineArtifact@2
276-
displayName: Download nupkg from artifacts
277-
inputs:
278-
artifact: Nugets
279-
source: current
280284
- powershell: |
281285
$fileNames = "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Workbench.*.nupkg"
282286
foreach($fileName in $fileNames) {
@@ -294,6 +298,13 @@ extends:
294298
publishFeedCredentials: 'OpenAPI Nuget Connection'
295299

296300
- deployment: deploy_readers
301+
templateContext:
302+
type: releaseJob
303+
isProduction: true
304+
inputs:
305+
- input: pipelineArtifact
306+
artifactName: Nugets
307+
targetPath: '$(Pipeline.Workspace)'
297308
dependsOn: deploy_lib
298309
environment: nuget-org
299310
strategy:
@@ -302,11 +313,6 @@ extends:
302313
pool:
303314
vmImage: ubuntu-latest
304315
steps:
305-
- task: DownloadPipelineArtifact@2
306-
displayName: Download nupkg from artifacts
307-
inputs:
308-
artifact: Nugets
309-
source: current
310316
- task: 1ES.PublishNuget@1
311317
displayName: 'NuGet push'
312318
inputs:

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @irvinesunday @darrelmiller @gavinbarron @millicentachieng @MaggieKimani1 @andrueastman
1+
* @irvinesunday @darrelmiller @gavinbarron @millicentachieng @MaggieKimani1 @andrueastman @baywet

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
id: getversion
3131
- name: Push to GitHub Packages - Nightly
3232
if: ${{ github.ref == 'refs/heads/vnext' }}
33-
uses: docker/build-push-action@v6.9.0
33+
uses: docker/build-push-action@v6.10.0
3434
with:
3535
push: true
3636
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
3737
- name: Push to GitHub Packages - Release
3838
if: ${{ github.ref == 'refs/heads/master' }}
39-
uses: docker/build-push-action@v6.9.0
39+
uses: docker/build-push-action@v6.10.0
4040
with:
4141
push: true
4242
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<PrivateAssets>all</PrivateAssets>
3939
</PackageReference>
4040
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
41-
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.2" />
41+
<PackageReference Include="Microsoft.OData.Edm" Version="8.2.3" />
4242
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.7" />
4343
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
4444
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ private static async Task<OpenApiDocument> GetOpenApiAsync(HidiOptions options,
254254
{
255255
stream = await GetStreamAsync(options.OpenApi, logger, cancellationToken).ConfigureAwait(false);
256256
var result = await ParseOpenApiAsync(options.OpenApi, format, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false);
257-
document = result.OpenApiDocument;
257+
document = result.Document;
258258
}
259259
else throw new InvalidOperationException("No input file path or URL provided");
260260

@@ -357,7 +357,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
357357
{
358358
var statsVisitor = new StatsVisitor();
359359
var walker = new OpenApiWalker(statsVisitor);
360-
walker.Walk(result.OpenApiDocument);
360+
walker.Walk(result.Document);
361361

362362
logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report..");
363363
#pragma warning disable CA2254
@@ -376,7 +376,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
376376

377377
if (result is null) return null;
378378

379-
return result.OpenApiDiagnostic.Errors.Count == 0;
379+
return result.Diagnostic.Errors.Count == 0;
380380
}
381381

382382
private static async Task<ReadResult> ParseOpenApiAsync(string openApiFile, string format, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default)
@@ -437,7 +437,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document, string for
437437
var sb = new StringBuilder();
438438
document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb)));
439439

440-
var doc = OpenApiDocument.Parse(sb.ToString(), format).OpenApiDocument;
440+
var doc = OpenApiDocument.Parse(sb.ToString(), format).Document;
441441

442442
return doc;
443443
}
@@ -647,7 +647,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl
647647

648648
private static void LogErrors(ILogger logger, ReadResult result)
649649
{
650-
var context = result.OpenApiDiagnostic;
650+
var context = result.Diagnostic;
651651
if (context.Errors.Count != 0)
652652
{
653653
using (logger.BeginScope("Detected errors"))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>2.0.0-preview2</Version>
6+
<Version>2.0.0-preview3</Version>
77
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
88
<SignAssembly>true</SignAssembly>
99
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->

src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public ReadResult Read(MemoryStream input,
6161
diagnostic.Errors.Add(new($"#line={ex.LineNumber}", ex.Message));
6262
return new()
6363
{
64-
OpenApiDocument = null,
65-
OpenApiDiagnostic = diagnostic
64+
Document = null,
65+
Diagnostic = diagnostic
6666
};
6767
}
6868

src/Microsoft.OpenApi.Workbench/MainModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ internal async Task ParseDocumentAsync()
246246
}
247247

248248
var readResult = await OpenApiDocument.LoadAsync(stream, Format.GetDisplayName());
249-
var document = readResult.OpenApiDocument;
250-
var context = readResult.OpenApiDiagnostic;
249+
var document = readResult.Document;
250+
var context = readResult.Diagnostic;
251251

252252
stopwatch.Stop();
253253
ParseTime = $"{stopwatch.ElapsedMilliseconds} ms";

src/Microsoft.OpenApi/Microsoft.OpenApi.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<LangVersion>Latest</LangVersion>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>2.0.0-preview2</Version>
6+
<Version>2.0.0-preview3</Version>
77
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
88
<SignAssembly>true</SignAssembly>
99
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->

src/Microsoft.OpenApi/Models/OpenApiTag.cs

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -55,56 +55,31 @@ public OpenApiTag(OpenApiTag tag)
5555
{
5656
Name = tag?.Name ?? Name;
5757
Description = tag?.Description ?? Description;
58-
ExternalDocs = tag?.ExternalDocs != null ? new(tag?.ExternalDocs) : null;
58+
ExternalDocs = tag?.ExternalDocs != null ? new(tag.ExternalDocs) : null;
5959
Extensions = tag?.Extensions != null ? new Dictionary<string, IOpenApiExtension>(tag.Extensions) : null;
6060
UnresolvedReference = tag?.UnresolvedReference ?? UnresolvedReference;
61-
Reference = tag?.Reference != null ? new(tag?.Reference) : null;
61+
Reference = tag?.Reference != null ? new(tag.Reference) : null;
6262
}
6363

6464
/// <summary>
6565
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.1
6666
/// </summary>
67-
public virtual void SerializeAsV31(IOpenApiWriter writer)
67+
public virtual void SerializeAsV31(IOpenApiWriter writer)
6868
{
69-
SerializeInternal(writer, (writer, element) => element.SerializeAsV31(writer));
70-
}
71-
72-
/// <summary>
73-
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.0
74-
/// </summary>
75-
public virtual void SerializeAsV3(IOpenApiWriter writer)
76-
{
77-
SerializeInternal(writer, (writer, element) => element.SerializeAsV3(writer));
78-
}
79-
80-
/// <summary>
81-
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.0
82-
/// </summary>
83-
private void SerializeInternal(IOpenApiWriter writer, Action<IOpenApiWriter, IOpenApiSerializable> callback)
84-
{
85-
Utils.CheckArgumentNull(writer);
86-
writer.WriteValue(Name);
87-
}
88-
89-
/// <summary>
90-
/// Serialize to OpenAPI V3 document without using reference.
91-
/// </summary>
92-
public virtual void SerializeAsV31WithoutReference(IOpenApiWriter writer)
93-
{
94-
SerializeInternalWithoutReference(writer, OpenApiSpecVersion.OpenApi3_1,
69+
SerializeInternal(writer, OpenApiSpecVersion.OpenApi3_1,
9570
(writer, element) => element.SerializeAsV31(writer));
9671
}
9772

9873
/// <summary>
99-
/// Serialize to OpenAPI V3 document without using reference.
74+
/// Serialize <see cref="OpenApiTag"/> to Open Api v3.0
10075
/// </summary>
101-
public virtual void SerializeAsV3WithoutReference(IOpenApiWriter writer)
76+
public virtual void SerializeAsV3(IOpenApiWriter writer)
10277
{
103-
SerializeInternalWithoutReference(writer, OpenApiSpecVersion.OpenApi3_0,
78+
SerializeInternal(writer, OpenApiSpecVersion.OpenApi3_0,
10479
(writer, element) => element.SerializeAsV3(writer));
10580
}
10681

107-
internal virtual void SerializeInternalWithoutReference(IOpenApiWriter writer, OpenApiSpecVersion version,
82+
internal virtual void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version,
10883
Action<IOpenApiWriter, IOpenApiSerializable> callback)
10984
{
11085
writer.WriteStartObject();
@@ -128,15 +103,6 @@ internal virtual void SerializeInternalWithoutReference(IOpenApiWriter writer, O
128103
/// Serialize <see cref="OpenApiTag"/> to Open Api v2.0
129104
/// </summary>
130105
public virtual void SerializeAsV2(IOpenApiWriter writer)
131-
{
132-
Utils.CheckArgumentNull(writer);
133-
writer.WriteValue(Name);
134-
}
135-
136-
/// <summary>
137-
/// Serialize to OpenAPI V2 document without using reference.
138-
/// </summary>
139-
public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
140106
{
141107
writer.WriteStartObject();
142108

0 commit comments

Comments
 (0)