-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Update Microsoft.OpenApi to preview28 #62363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -2,11 +2,11 @@ | |||
Microsoft.AspNetCore.Builder.OpenApiEndpointConventionBuilderExtensions | |||
Microsoft.AspNetCore.Builder.OpenApiEndpointRouteBuilderExtensions | |||
Microsoft.AspNetCore.OpenApi.IOpenApiDocumentTransformer | |||
Microsoft.AspNetCore.OpenApi.IOpenApiDocumentTransformer.TransformAsync(Microsoft.OpenApi.Models.OpenApiDocument! document, Microsoft.AspNetCore.OpenApi.OpenApiDocumentTransformerContext! context, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't touch this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codefixer for the PublicAPI analyzer applied this delta. Although I think it just reveals an underlying bug in the way the PublicAPI analyzer works? In this case, the same types for existing APIs have been moved to new namespaces. Maybe the delta here is to remove all the old APIs and then add the new ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change announcement probably needed for API changing?
@@ -98,7 +97,8 @@ public static Task Verify(string source, IIncrementalGenerator generator, Dictio | |||
.ScrubLinesWithReplace(line => InterceptsLocationRegex().Replace(line, "[InterceptsLocation]")) | |||
.UseDirectory(SkipOnHelixAttribute.OnHelix() | |||
? Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "snapshots") | |||
: "snapshots"); | |||
: "snapshots") | |||
.AutoVerify(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
@@ -38,6 +36,7 @@ public async Task VerifyOpenApiDocument(string documentName, OpenApiSpecVersion | |||
var outputDirectory = Path.Combine(baseSnapshotsDirectory, version.ToString()); | |||
await Verifier.Verify(json) | |||
.UseDirectory(outputDirectory) | |||
.UseParameters(documentName); | |||
.UseParameters(documentName) | |||
.AutoVerify(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
using Microsoft.OpenApi; | ||
using Microsoft.OpenApi.Extensions; | ||
using Microsoft.OpenApi.Writers; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
@@ -140,10 +137,11 @@ internal async Task<OpenApiSchema> GetOrCreateUnresolvedSchemaAsync(OpenApiDocum | |||
internal async Task<IOpenApiSchema> GetOrCreateSchemaAsync(OpenApiDocument document, Type type, IServiceProvider scopedServiceProvider, IOpenApiSchemaTransformer[] schemaTransformers, ApiParameterDescription? parameterDescription = null, CancellationToken cancellationToken = default) | |||
{ | |||
var schema = await GetOrCreateUnresolvedSchemaAsync(document, type, scopedServiceProvider, schemaTransformers, parameterDescription, cancellationToken); | |||
return ResolveReferenceForSchema(document, schema); | |||
var baseSchemaId = optionsMonitor.Get(documentName).CreateSchemaReferenceId(_jsonSerializerOptions.GetTypeInfo(type)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this expensive? Do we care?
@@ -712,18 +708,15 @@ await VerifyOpenApiDocument(builder, document => | |||
|
|||
// Assert items are arrays of strings | |||
Assert.Equal(JsonSchemaType.Array, seq1Schema.Items.Type); | |||
// Todo: See https://github.com/microsoft/OpenAPI.NET/issues/2062 | |||
// Assert.Equal(JsonSchemaType.Array, seq2Schema.Items.Type); | |||
Assert.Equal(JsonSchemaType.Array, seq2Schema.Items.Type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{ | ||
return document.AddOpenApiSchemaByReference(schemaIdString, schema); | ||
} | ||
var relativeSchemaId = $"#/components/schemas/{rootSchemaId}{refIdString.Replace("#", string.Empty)}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this where the tags
and items
updates in the tests comes from?
Do we want to add any explicit testing here?
Comparing main vs this PR, there's already a tonne of breaking changes via Microsoft.OpenApi in already shipped previews of 10. This is just even more churn on top of what we've had already 😅. |
This pull request primarily updates the
Microsoft.OpenApi
package versions and refactors code to simplify imports and improve type usage. The most significant changes include updating dependencies, replacing outdatedMicrosoft.OpenApi.Models
types with the newMicrosoft.OpenApi
namespace, and modifying public API definitions accordingly.Dependency Updates:
MicrosoftOpenApiVersion
andMicrosoftOpenApiYamlReaderVersion
from2.0.0-preview.18
to2.0.0-preview.28
ineng/Versions.props
.Refactoring Imports:
Microsoft.OpenApi.Models
,Microsoft.OpenApi.Models.Interfaces
, andMicrosoft.OpenApi.Models.References
in favor of the newMicrosoft.OpenApi
namespace across multiple files, includingXmlCommentGenerator.Emitter.cs
,TransformersBenchmark.cs
, and various transformer files in thesample
directory. [1] [2] [3] [4] [5] [6] [7]Code Adjustments:
schema.Extensions
from an empty array ([]
) to aDictionary<string, IOpenApiExtension>
inTransformersBenchmark.cs
. [1] [2]Public API Updates:
PublicAPI.Shipped.txt
to reflect the transition fromMicrosoft.OpenApi.Models
types toMicrosoft.OpenApi
types. This includes changes to method signatures and transformer interfaces. [1] [2] [3]Project Configuration:
<Using Include="Microsoft.OpenApi" />
to theSample.csproj
andMicrosoft.AspNetCore.OpenApi.csproj
files to simplify namespace management. [1] [2]