microsoft / OpenAPI.NET

The OpenAPI.NET SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
MIT License
1.42k stars 239 forks source link

v2 - OpenApiModelFactory.GetStreamAsync should accept a cancellation token #1916

Open baywet opened 4 days ago

baywet commented 4 days ago

https://github.com/microsoft/OpenAPI.NET/blob/cb5bb2797a4a4aa61c96d4fd453ac5257474848d/src/Microsoft.OpenApi/Reader/OpenApiModelFactory.cs#L300

To pass it to GetStreamAsync. (conditional compilation on NET5 or higher).

All callers to this method should pass the value, and accept one.

This is important as if the action is being cancelled on a backend service, this will forward the cancellation to the HTTP request being made, saving important COGS in the process.

MaggieKimani1 commented 2 days ago

The core library only targets netstandard 2.0

baywet commented 2 days ago

My suggestion is to add additional targets and conditional compilation to better support high-throughput scenarios.

We should probably have a separate conversation about the netstandard2.0 target which gives us netfx + a bunch of end of life net core versions (when compared with lets say net6).